Gary,
TopLink Essentials has its own native metamodel you can use as well. Do you have access to an EntityManagerFactory in your usage or just managed EntityManager instances?
Doug
-----Original Message-----
From: Gary Jacobson [mailto:gtjacobson_at_gmail.com]
Sent: March 1, 2010 3:52 AM
To: persistence_at_glassfish.dev.java.net
Subject: Re: List of entity classes
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