-->
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: Is it possible to retrieve the db column length in hibernate
PostPosted: Tue Mar 15, 2016 9:39 am 
Newbie

Joined: Mon Mar 14, 2016 11:34 am
Posts: 1
Tried doing this.But the results are not accurate.

Property property = (Property)persistentClass.getProperty(propertyName);
((Column)property.getColumnIterator().next()).getLength();


System.out.print(persister.getPropertyColumnNames(propertyName)[0]);

I have following table structure:
TYPE_NAME VARCHAR2(200)
CREATION_DATE DATE
CREATED_BY VARCHAR2(200) Y
LAST_UPDATE_DATE DATE Y
LAST_UPDATED_BY VARCHAR2(200) Y
DISPLAY_NAME VARCHAR2(200) Y
ENABLED VARCHAR2(1) Y
DESCRIPTION VARCHAR2(4000) Y


The results I got is:

CREATED_BY Column length :::255 STRING
CREATION_DATE Column length :::255 TIMESTAMP
DESCRIPTION Column length :::255 STRING
DISPLAY_NAME Column length :::200 STRING
ENABLED Column length :::255 STRING
LAST_UPDATED_BY Column length :::255 STRING
LAST_UPDATE_DATE Column length :::255 TIMESTAMP
TYPE_NAME Column length :::200 STRING

Please advice


Top
 Profile  
 
 Post subject: Re: Is it possible to retrieve the db column length in hibernate
PostPosted: Tue Mar 15, 2016 12:45 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You can also use the JDBC meta data for that.


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.