persistence@glassfish.java.net

Re: List of entity classes

From: Gary Jacobson <gtjacobson_at_gmail.com>
Date: Mon, 1 Mar 2010 10:52:29 +0200

Thanks Doug

Unfortunately I am stuck with Toplink Essentials 2.0... do you know of any
equivalent class/method I could use?

---------- Forwarded message ----------
> From: Douglas Clarke <DOUGLAS.CLARKE_at_oracle.com>
> To: persistence_at_glassfish.dev.java.net
> Date: Thu, 25 Feb 2010 04:24:22 -0800 (PST)
> Subject: RE: List of entity classes
> If you are using the latest JPA 2.0 version of EclipseLink you can use:
>
> EntityManagerFactory.getMetamodel();
>
> Doug
>
> -----Original Message-----
> *From:* Gary Jacobson [mailto:gtjacobson_at_gmail.com]
> *Sent:* February 25, 2010 7:00 AM
> *To:* persistence_at_glassfish.dev.java.net
> *Subject:* List of entity classes
>
> Hi all
>
> Is there any way to retrieve a list of the entity classes available in the
> application? (i.e. any class with @Entity annotated)
>
> The only way I can think to do this is to use native SQL to get a list of
> all database table names, convert them to class names by using my naming
> convention, and loading each class via reflection.
>
> I would guess that there must be some internal toplink utility class which
> maintains a list.
>
> Thanks
> Gary
>
>
>