-->
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.  [ 3 posts ] 
Author Message
 Post subject: Retrieve field length
PostPosted: Fri Mar 03, 2006 5:39 am 
Newbie

Joined: Fri Mar 03, 2006 5:29 am
Posts: 1
Hibernate version:
3.1.2

Name and version of the database:
MySQL 5

Question
I use spring and hibernate. I'm not sure if it is a pure hibernate question, but is it possible to retrieve the length of a field in a tablecolumn? Like a mysql table where a person table has a firstName field with a length of 25? Then trying to retrieve the length?

Thanx Kenny


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 6:35 am 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
Well this is more a JDBC question, you can use session.connection().getMetaData().getColumns() I'm not sure what will be returned but this is the way to go IMO.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 5:42 pm 
Newbie

Joined: Tue Jun 07, 2005 10:45 pm
Posts: 15
Location: Sydney
Something like

Code:
configuration.getClassMapping("Person").getTable().getColumn(new Column("firstName")).getLength();


Don't forget to rate :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.