-->
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: cutting fields that are too long
PostPosted: Sun Jul 04, 2004 10:53 am 
Newbie

Joined: Mon Nov 17, 2003 10:53 am
Posts: 15
hi,

i know this is no fault of hibernate but maybe somebody
knows are workaround using hibernate.

i am using postgres (but this is certainly a 'feature' of
many dbs). sometimes i get the following exception
"value too long for type character varying" which happens
exactly in cases when the value i want to save is longer
than specified on the db. depending on your point of view
this might be ok or not. im my case it is not. what i want is
to simply cut off the value at max size and be done.
no exceptions please ;-)

does anybody know how to workaround this either
by hibernate or by using the postgres jdbc driver or
whatever.

btw. i would find an attribute on the property element
way cool. so one would be able to respecify the facts
on the db table.

<property name="foo" lenght="10">
this would drop everything greater than 10 chars long.

ciao robertj
ps: my best bet at the moment would be to use
aspectj but it would "feel" more natural doing this as close
to the db as possible.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 04, 2004 12:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I'd say, just use custom UserType. If you feel adventourous use cvs Hibernate3 with parameterizable types.


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.