-->
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: Get qualified table name given Java class name
PostPosted: Wed Feb 16, 2005 7:04 pm 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
Greetings.

I need to get the name of the table, which is mapped to the given Java class. The returned table name needs to be fully qualified and have schema name as a part of it. I tried using MappingStrategy.classToTableName(), but it doesn't include the table schema as a part of the returned table name.

Is there any Hibernate API I can use to get fully qualified table name?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 7:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Configuration object can be used for this purpose.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 7:24 pm 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
The following worked for me, but seems too convoluted:

config.getClassMapping(clazz).getTable() .getQualifiedName(Dialect.getDialect(config.getProperties())


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 18, 2005 12:07 pm 
Regular
Regular

Joined: Fri Mar 26, 2004 11:45 am
Posts: 75
It turns put that the above solution works well if the schema is specified in the class mapping (.hbm.cfg) file. However, it does not take the default schema setting in (hibernate.properties) into consideration.

Can anyone suggest an alternative solution for getting a fully-qualified table name given the Java class mapped to this table?

Thanks.


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.