Assuming you are using a recent version of NHibernate, all you need to do is 
set a "length" attribute to something higher than 4000.  You can also omit the 
type="StringClob"; that's for ntext fields.

So your mapping should look like this:
<property name="Data" length="10000"/>

-Tyler Burd


From: [email protected] [mailto:[email protected]] On 
Behalf Of Ramon Smits
Sent: Friday, May 17, 2013 8:54 AM
To: nservicebus; nhusers
Subject: [nservicebus] nvarvchar(max) issues



This is crossposted to NServiceBus and NHUsers mailing list.


I have a custom mapping (hbm.xml) for a saga class. One property should be 
mapped to a nvarchar(max) column.

I started with the following property type:

    <property name="Data" type="StringClob"/>


This created the correct schema but when data is getting larger then 4000 
characters I'm getting the following exception:

     NHibernate.HibernateException
     The length of the string value exceeds the length configured in the 
mapping/parameter.


During initialization I see that the property is mapped but I don't see a 
reference to StringClobType.


In the log I see the following:

     [Debug] binding '.....' to parameter: 4  (NHibernate.Type.StringType)


So it seems that although the property type is set to StringClob that this type 
is not used.


I tried several different mappings that are mentioned in the following posts 
but without success:

 * 
http://www.primordialcode.com/blog/post/nhibernate-prepare_sql-considerations-mapping-long-string-fields
 * http://zvolkov.com/clog/2009/10/28?s=NHibernate+parameter+sizes+controversy



Does anybody have a solution for this problem?



-- Ramon
__._,_.___
Reply via web 
post<http://groups.yahoo.com/group/nservicebus/post;_ylc=X3oDMTJybTlnaTAwBF9TAzk3MzU5NzE0BGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRtc2dJZAMxOTA5NQRzZWMDZnRyBHNsawNycGx5BHN0aW1lAzEzNjg4MDI0NDM-?act=reply&messageNum=19095>

Reply to sender 
<mailto:[email protected]?subject=Re%3A%20nvarvchar%28max%29%20issues>

Reply to group 
<mailto:[email protected]?subject=Re%3A%20nvarvchar%28max%29%20issues>

Start a New 
Topic<http://groups.yahoo.com/group/nservicebus/post;_ylc=X3oDMTJmc2tudWpoBF9TAzk3MzU5NzE0BGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRzZWMDZnRyBHNsawNudHBjBHN0aW1lAzEzNjg4MDI0NDM->

Messages in this 
topic<http://groups.yahoo.com/group/nservicebus/message/19095;_ylc=X3oDMTM3bnVvOWFpBF9TAzk3MzU5NzE0BGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRtc2dJZAMxOTA5NQRzZWMDZnRyBHNsawN2dHBjBHN0aW1lAzEzNjg4MDI0NDMEdHBjSWQDMTkwOTU->
 (1)

Recent Activity:
*         New 
Members<http://groups.yahoo.com/group/nservicebus/members;_ylc=X3oDMTJnZm5tbWRuBF9TAzk3MzU5NzE0BGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRzZWMDdnRsBHNsawN2bWJycwRzdGltZQMxMzY4ODAyNDQz?o=6>
 5
Visit Your 
Group<http://groups.yahoo.com/group/nservicebus;_ylc=X3oDMTJmMm40czZuBF9TAzk3MzU5NzE0BGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRzZWMDdnRsBHNsawN2Z2hwBHN0aW1lAzEzNjg4MDI0NDM->
[http://l.yimg.com/a/i/us/yg/logo/us.gif]<http://groups.yahoo.com/;_ylc=X3oDMTJlN2oycTY5BF9TAzk3NDc2NTkwBGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRzZWMDZnRyBHNsawNnZnAEc3RpbWUDMTM2ODgwMjQ0Mw-->
Switch to: 
Text-Only<mailto:[email protected]?subject=Change%20Delivery%20Format:%20Traditional>,
 Daily 
Digest<mailto:[email protected]?subject=Email%20Delivery:%20Digest>
 * 
Unsubscribe<mailto:[email protected]?subject=Unsubscribe> 
* Terms of Use<http://docs.yahoo.com/info/terms/> * Send us Feedback 
<mailto:[email protected]?subject=Feedback%20on%20the%20redesigned%20individual%20mail%20v1>
.

__,_._,___

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to