-->
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: Annotation Scanner
PostPosted: Wed May 19, 2010 6:42 pm 
Newbie

Joined: Tue Nov 03, 2009 2:54 pm
Posts: 4
At runtime I want to get a list of all the @Entity classes. When Hibernate loads it will read the classes from the persistence.xml file, or maybe it will scan the classpath. Either way, hibernate discovers all the @Entity objects.

Is there a way for me to access a Collection<? extends @Entity> from hibernate at runtime after hibernate has already loaded these objects, preferably from the EntityManager?

Thanks,
Axiopisty


Top
 Profile  
 
 Post subject: Re: Annotation Scanner
PostPosted: Thu May 20, 2010 5:55 am 
Regular
Regular

Joined: Thu Dec 10, 2009 10:53 am
Posts: 50
you can do sth. like:
Code:
(Collection<ClassMetadata>)getSessionFactory().getAllClassMetadata().values()

and these give you acces to the class and some other metadata, such as
Code:
cmd.getEntityName()


dunno, about EntityManager, though.


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.