Den 26 april 2012 14:14 skrev nfplee <[email protected]>: > Hi, i have just upgraded an application to version 3.3.0GA and have > notificed a bug when inserting large amounts of data into a NVarChar(MAX) > field in the database (also tested with NText). It throws the following > error: > > The length of the string value exceeds the length configured in the > mapping/parameter. > > With the following mapping: > > <property name="Body"> > <column name="Body" /> > </property>
Not specifying a length makes NHibernate default to 4000 (unicode) characters. > > The original mapping worked fine before. This looks like a pretty bad bug to > me. I was wondering if anyone else could confirm this. What happened in 3.2 etc. was that your string was being silently truncated to 4000 characters, or whatever length you specified. Intended behavior in 3.3GA SchemaExport use the defined length and create nvarchar(max) if longer than 4000 characters (report a bug if this is not the case). SQL string parameters will have their size rounded up to 4000 characters, unless more is required in which case it will be rounded up to Int.MaxValue/2 (on ms sql server). When setting the value of a string parameter, NHibernate will throw if the string is longer than the defined length of the string parameter to prevent ADO.NET from performing silent truncation of the string. /Oskar
