-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: problem with mapping type
PostPosted: Tue May 23, 2006 2:44 am 
Newbie

Joined: Mon Feb 06, 2006 8:53 am
Posts: 7
Location: Antwerp Belgium
Hi all,


I'm using a sql server database where I have a table with a text column in it
so lets say my
description field as the type text

I mapped that column like

<property name=m_Description column=description>

and the description looked like this

private string m_Description

when I wanted to insert some text (more than 4000 characters) the text was truncated to 4000 characters.
So my question

How can I map this text column in hybernate without loosing any data when saving my object??

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 12:05 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
well the obvious answer is to increase the size of your text column or switch to another column type that . however, i think the answer you are looking for is to use a try/catch block. if you catch the exception, NH should return a "Cannot insert. Object would be truncated." error that you can handle apprioriately.

imho, your presentation layer should also do some validation that prevnts the user from entering more than whatever the maximum character count is.

-devon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.