views:

126

answers:

2

My DB schema has a string as a varchar(max). I have read the other questions concerning setting Length to more than 4000 or 8000 so that it really generates a (n)varchar(max) in the mapping but when I use Length(10000) in my mapping class, the hbm file actually shows length="10000" and if I save an entity with more than 10000 chars, it is actually truncated to exactly 10000 chars.

I don't want any truncation.

(using NH3-alpha2 and FNH trunk)

+2  A: 

It would appear that this is an old problem which is now resurfacing in NHibernate 3.x builds; you can read about the workarounds here.

DanP
Calling CustomType("StringClob") did it. Thx.
Nicolas Cadilhac
+1  A: 

This mapping should work:

<property name="TheProperty" type="StringClob">
  <column name="TheColumn" sql-type="nvarchar(max)" />
</property>

Just look for the fluent equivalent.

Diego Mijelshon
@Diego - do you think this will ever be treated properly in NHib 3? Kind of sad to see the sql server specific details leak through in the mapping like this...
DanP
@DanP can you open a Jira issue?
Diego Mijelshon
@Diego - I believe there already is one: http://216.121.112.228/browse/NH-2302 Incidentally...would you be interested in a donated domain name for the JIRA or something? Having an IP based url seems a little...inconvenient ;)
DanP
@DanP, the domain name is jira.nhforge.org, I have no clue why it's being using the IP for some months now. I don't administer it, but you can ask in the dev list.
Diego Mijelshon