The problem was that the mapping was previously an embedded resource,
creating the table column with the correct type. Then the mapping was not
an embedded resource any more and resided on the file system. NServiceBus
initializes NHibernate by passing a set of assemblies to scan so this did
not work resulting in the normal behavior of nservicebus that resulted in
using nvarchar(255).

So the problem was not NHibernate, but the fact that the whole mapping was
not loaded.


-- Ramon


On Fri, May 17, 2013 at 5:08 PM, Tyler Burd <[email protected]> wrote:

>
>
> 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****
>
> ****
>
>
> __._,_.___
>
>
>  Your email settings: Individual Email|Traditional
> Change settings via the 
> Web<http://groups.yahoo.com/group/nservicebus/join;_ylc=X3oDMTJnNTh1NHM2BF9TAzk3NDc2NTkwBGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRzZWMDZnRyBHNsawNzdG5ncwRzdGltZQMxMzY4ODAzMzEy>(Yahoo!
>  ID required)
> Change settings via email: Switch delivery to Daily 
> Digest<[email protected]?subject=Email+Delivery:+Digest>| 
> Switch
> to Fully 
> Featured<[email protected]?subject=Change+Delivery+Format:+Fully+Featured>
>  Visit Your Group
> <http://groups.yahoo.com/group/nservicebus;_ylc=X3oDMTJlcWEybnFoBF9TAzk3NDc2NTkwBGdycElkAzIxMzgzMTE4BGdycHNwSWQDMTcwNTAwNDc2MwRzZWMDZnRyBHNsawNocGYEc3RpbWUDMTM2ODgwMzMxMg-->|
>  Yahoo!
> Groups Terms of Use <http://docs.yahoo.com/info/terms/> | Unsubscribe
> <[email protected]?subject=Unsubscribe>
>
> __,_._,___
>

-- 
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