Search code examples
nhibernatefluent-nhibernatesql-server-2008-express

Binary Blob truncated to 8000 bytes - SQL Server 2008 / varbinary(max)


I have upgraded from Fluent Nhibernate 1.0 with Nhibernate 2.1 to pre- release 1.x with NHibernate 3.0 GA and have hit what I think is a regression, but I want to hear if that's indeed the case.

I am using SQL Server Express 2008 and the MSSQL 2008 dialect and have an Image property of type System.Drawing.Image and I have mapped it like this:

Map (food => food.Image)
 .Length (int.MaxValue)
 .Nullable ();

The Image column in the table is of type varbinary(MAX).

The generated hbm for the property is:

<property name="Image" type="System.Drawing.Image, System.Drawing,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
   <column name="Image" length="2147483647" not-null="false" />
</property>`

However no matter what I do the binary blob is truncated to 8000 bytes when serialized with the current FNH and NH versions. That didn't used to be the case with previous versions.

Ideas of why this is happening and how to fix/workaround it?


Solution

  • This is a regression. I have raised a bug and provided patches at https://nhibernate.jira.com/browse/NH-2484