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: Retrieve the
PostPosted: Mon Aug 07, 2006 10:52 pm 
Regular
Regular

Joined: Tue Oct 14, 2003 11:11 pm
Posts: 62
Location: Brasil/Curitiba
Hi,

I need read the Metadata from some hbm.xml.

I read the required fields (not-null), but I could not find a way to read the column length and precision, is it possible?

thank you
Ricardo

_________________
Ricardo Lecheta


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 08, 2006 1:30 am 
Regular
Regular

Joined: Mon Mar 06, 2006 6:18 am
Posts: 95
Location: Bern, Switzerland
hello

for me it worked like this, just iterate through the table columns:


Code:
      Table table = classMapping.getTable();

      Map lengthMapping = new HashMap();
      Map scaleMapping = new HashMap();
      Map precisionMapping = new HashMap();
      for (Iterator iter = table.getColumnIterator(); iter.hasNext();) {
         Column column = (Column) iter.next();
         lengthMapping.put(column.getName(), new Integer(column.getLength()));
         scaleMapping.put(column.getName(), new Integer(column.getScale()));
         precisionMapping.put(column.getName(), new Integer(column.getPrecision()));
      }


angela


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.