-->
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.  [ 4 posts ] 
Author Message
 Post subject: How can I Retrieve the corresponding Table name?
PostPosted: Fri Mar 10, 2006 12:37 am 
Newbie

Joined: Tue Feb 22, 2005 3:26 am
Posts: 8
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:2.1.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:Oracle 9i2

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

How can I Retrieve the corresponding table name and column names from the class name and properties?


Top
 Profile  
 
 Post subject: configuration
PostPosted: Fri Mar 10, 2006 12:57 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
configuration.getClassMapping( "ClasName").getTable().getName();

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 10, 2006 6:19 am 
Newbie

Joined: Tue Feb 22, 2005 3:26 am
Posts: 8
Thank you,kgignatyev! But how can I get the configure instance?In fact,I want to use this in the Interceptor, and what about the columns? Thank you advance!


Last edited by zey on Fri Mar 10, 2006 12:16 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 10, 2006 11:52 am 
Newbie

Joined: Tue Feb 22, 2005 3:26 am
Posts: 8
I have found the answer
Iterator iter = cfg.getClassMapping(entity.getClass()).getProperty(propertyName).getColumnIterator();
String columnName = ((Column)iter.next()).getName();


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