"epbernard" wrote : If we are OK to go the non standard route, I can look at 
adding  a method on HibernateEntityManagerFactory. 
  | Set<Class<?>> getEntities();
  |  returning the list of entities.
  | 
  | Or even better you can do
  | 
  | Collection metadatas = (Map) ( (HibernateEntityManagerFactory) emf 
).getSessionFactory().getAllClassMetadata().values();
  | 
  | for(ClassMetadata metadata : metadatas) {
  |   Class<?> entityType = metadata.getMappedClass(EntityMode.POJO);
  |   if (entityType != null) 
  |     doStuffCauseItsAnEntity( entityType );
  | }

I think it is good way, so 

public Collection<Class<?>> discoverEntities();

is executed in context of deployed PU. EMF should take responsibility to 
discover which entities belong to it and expose API to get that information. So 
code for hibernate is ready, and for EMF which now doesn't expose similair API 
code discoverEntities should throw exception ..?

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4225600#4225600

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4225600
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to