-->
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: persisting to varchar: silently ignores too long String
PostPosted: Wed Feb 10, 2010 12:42 pm 
Newbie

Joined: Wed Feb 10, 2010 12:18 pm
Posts: 2
Hello!

When persisting a String of length eg. 1024 to a varchar column with a length of e.g. 255 (the string does not fit into the column) this is silenty ignored. the string is just cut.

i'd like to be advised how to configure hibernate to either throw some exception or any other solution to give me the chance of an adequate handling.

I'm configuring hibernate via annotations and I'm using a proxied annotation-driven transaction manager
hibernate v.3.1.3
hibernate-annotations v.3.4.0.GA
hibernate-entitymanager v.3.4.0.GA
spring v.2.5.6
java 1.6.0_17
hsqldb v1.8.0

thanks!


Top
 Profile  
 
 Post subject: Re: persisting to varchar: silently ignores too long String
PostPosted: Wed Feb 10, 2010 12:49 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Check out Hibernate Validator: http://docs.jboss.org/hibernate/stable/ ... e/en/html/
There is a built-in constraint @Length, that allows you to set min and max length of a string.


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.