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: Testing if a value fits in field's size
PostPosted: Thu Apr 22, 2004 6:54 am 
Newbie

Joined: Thu Apr 22, 2004 6:46 am
Posts: 1
Hello there,

Is there any way to verify the database field's size before performing a write operation (INSERT or UPDATE) ? The only one I know is to capture the exception thrown when the value does not fit in field. I am looking for a not-so-ugly approach :-)

Thanks in advance,

Fred

PS: I use both Oracle and HSQL, but I wonder if such kind of information can be retrieved from any DB.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 22, 2004 12:27 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
sure, use the java.sql.DatabaseMetaData reference obtained from the underlying connection to query various aspect regarding the database...

specifically, check out its getColumns() method


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.