NHibernate 3.0 binary data truncation

NHibernate 3.0.0 has a bug which silently truncates data going into varbinary(MAX) fields to 8000 bytes — not a pleasant one to find in production because your test documents weren’t big enough! This stackoverflow answer contains a workaround for hbm file mappings; translated to FluentNHibernate auto mapping it becomes:

var sessionFactory = Fluently.Configure()
    .Database(/* database config */)
    .Mappings(m => 
            .Override<Document>(map => 
                map.Map(d => d.Data).Length(2147483647))))

The bug is apparently fixed in 3.0.1.