string value is truncating when saved to the database
I am using hibernate, and my classes property is a string, and my mapping d开发者_如何转开发oesn't have any type information, ie:
<property name="html" />
I am storing a web page in the html database column, and for some reason the entire page isn't saving, it gets cut off part way.
I outputed the value of the property to console and it does output all the way to the ending </html>
tag.
Does hiberate truncate a string value?
the database column is a nvarchar(max) (sql server)
Turns out it was writing the entire string to the database, just copy and pasting from the database editor was truncating the actual text stored in the db column.
try
<property name="Value" type="LongVarChar" />
<property name="html" length="20000" />
I.e. specify the length attribute and set it to a value big enough.
Try
<property name="Value" type="StringClob" />
Otherwise, Hibernate needs to know the length when dealing with large strings.
精彩评论