The next code work for your goal:
Code:
private static Collection<String> getManagedClassNames() {
if (managedClassNames == null) {
// The next code is Hibernate dependent.
// This code has to be modified in order to work with Glassfish, OpenJPA, etc.
EntityManager manager = XPersistence.createManager();
org.hibernate.impl.SessionImpl impl = (org.hibernate.impl.SessionImpl) manager.getDelegate();
managedClassNames = impl.getSessionFactory().getAllClassMetadata().keySet();
manager.close();
}
return managedClassNames;
}
But it's hibernate dependent. Sorry!
Maybe there is a better way
Cheers
Javier Paniza