-->
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: String or binary data would be truncated.
PostPosted: Wed Sep 26, 2007 10:08 am 
Newbie

Joined: Thu Mar 29, 2007 9:39 am
Posts: 10
Hello,

Sometime i receive this error, when a field is too long :
String or binary data would be truncated.
The statement has been terminated.

I wonder if it can say which field is too long in the error message ?
Is it necessary to indicate the length in the mapping files ?

Thanks
Decco


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 11:03 am 
Regular
Regular

Joined: Fri Jan 20, 2006 7:45 pm
Posts: 97
Location: San Antonio, TX
Specifying property's size and type in mapping file does not appear to make a difference.

I use a DesignByContract class that I created for such checks that I use in my DAOs for such cases. The call looks like this:
Code:
Ckeck.Require(obj.Prop.Length < maxSize, "Property length enxceeded limit");

This throws an exception when the length exceeds max. I too wish NHibernate would throw an exception when specified lengths are exceeded.[/code]

_________________
Dum spiro, spero
-------------------------------
Rate my post if it helps...


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.