-->
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.  [ 3 posts ] 
Author Message
 Post subject: Retrieve Entity based on annotation
PostPosted: Fri May 02, 2008 8:00 am 
Beginner
Beginner

Joined: Fri Apr 20, 2007 1:07 am
Posts: 23
Hi All,

I use the Hibernate Entity Manager and annotations for my project. I need to retrieve the class name for an entity based on its annotations..

i.e. if an entity is marked as @Entity and @Table annotations, if I supply the table name I need the corresponding Entity and class name...Is there any utility class which I can supply the name and it would retrieve me the above data...something like a metadata utility class ?

Thanks in advance...

Regards..Vijay


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 7:54 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

all meta information is in the Configuration class. For example you could call getClassMappings() to get an Iterator of PersistentClass instances. This class should contain the information you need.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 07, 2008 7:09 am 
Beginner
Beginner

Joined: Fri Apr 20, 2007 1:07 am
Posts: 23
Hi,

Thanks for the reply...Unfortunately the Configurations class is just a startup class and the session factory does not hold an instance back to the Configuration class that it used to create in this...EJB3Configuration and Entitymanagerfactory

Any help on this is highly appreciated !!!!

Thanks...Vijay


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