Hi,
You can get the Hibernate session factory, on this session factory you can invoke the
getAllClassMetadata() method, for example
Code:
HibernateEntityManager entityManager2 = (HibernateEntityManager)entityManager;
SessionFactory factory = entityManager2.getSession().getSessionFactory();
Map m = factory.getAllClassMetadata();
Set<Map.Entry> s = m.entrySet();
for (Map.Entry e : s) {
System.out.println(e.getKey() + "--->" + e.getValue());
}
will print:
Code:
par.common.Address--->SingleTableEntityPersister(par.common.Address)
par.common.Customer--->SingleTableEntityPersister(par.common.Customer)
par.common.Catalog--->SingleTableEntityPersister(par.common.Catalog)
par.common.Service--->SingleTableEntityPersister(par.common.Service)
par.common.InternalService--->SingleTableEntityPersister(par.common.InternalService)
par.common.ExternalServiceTwoProviders--->SingleTableEntityPersister(par.common.ExternalServiceTwoProviders)
par.common.Attribute--->SingleTableEntityPersister(par.common.Attribute)
par.common.ExternalService--->SingleTableEntityPersister(par.common.ExternalService)
If you don't want to get an entity manager and cast it to Hibernate entity manager, and get the session factory out of it. You can add to your persistence.xml the 'hibernate.session_factory_name' property and ask Hibernate to register the session factory to a JNDI (assuming that you have one).
Eyal Lupu