Re: [nhusers] How to create a mapping file for VARCHAR(MAX) columns in NH 3.3.1

1,490 views
Skip to first unread message

Fran Knebels

unread,
Aug 27, 2012, 10:50:34 PM8/27/12
to nhu...@googlegroups.com

You have to tell of that it is a clobtype.

On Aug 27, 2012 10:43 PM, "Phil Haselden" <phas...@gmail.com> wrote:
I asked a question on StackOverflow about this: http://stackoverflow.com/questions/12105929/how-to-map-a-varcharmax-column-in-nhibernate-hbm-xml-mapping-files.

A suggestion was to do the following in the hbm.xml file:

<property name="MyBigAnsiColumn" type="AnsiString" length="1000000" />

However when I try to save 8001 chars to that column I get a NHibernate.PropertyValueException. If the column contains 8000 chars it works.

How do I map this type of column so that I can make use of the full size?

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/Tnv_qlnQlxUJ.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

Oskar Berggren

unread,
Aug 28, 2012, 1:46:09 AM8/28/12
to nhu...@googlegroups.com
To elaborate, if the type isn't specified in the mapping, NHibernate will pick a suitable string type based on the length. But since you force the type, you must force it to a suitable one for your length.

/Oskar


2012/8/28 Fran Knebels <fkne...@gmail.com>

Ramon Smits

unread,
Aug 28, 2012, 4:43:34 AM8/28/12
to nhu...@googlegroups.com
The problem is that there does not exist something as a AnsiStringClob
--
Ramon

Nexus

unread,
Aug 28, 2012, 8:37:55 AM8/28/12
to nhu...@googlegroups.com
<property name="MyBigAnsiColumn" type="StringClob" sql-type="VARCHAR(max)" />
Should be the most correct answer
Regards

Stefan Steinegger

unread,
Aug 30, 2012, 7:43:50 AM8/30/12
to nhu...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages