-->
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: Lots of fun w/ hibernate and JPA - getting table names
PostPosted: Thu Jul 26, 2007 2:11 am 
Newbie

Joined: Sun Apr 29, 2007 4:27 am
Posts: 10
Location: Israel
Due to some changes in my requirement, I’ve had to add some pure SQL queries in my code.
It’s not that beautiful – yet, that’s something I’ve to do.

The problem is, that I need to know what my table names are –
(I have the class name, and I want to get the representing DB table name)
I know that in hibernate, I can use the ‘classConfiguration’,
But when using JPA, I can’t use it anymore…

So, how do I do that with JPA?
Thanks in advance,
Sharon.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 26, 2007 11:15 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
Hi,

This might be possible by using the ClassMetadata from the SessionFactory, which can be obtained with the following call:

Code:
Map metadata = ((Session)entitymanager.getDelegate()).getSessionFactory().getAllClassMetadata();


I am not to sure which property you are searching for, but the key is the class name.

Cheers,

Andy

_________________
Rules are only there to be broken


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.