Hello,
I am upgrading to JBoss AS 5 and am migrating from 4.2. I had no problem creating JDK 5 based Hibernate annotations for my POJO's and used typical JNDI to get the entity manager for these annotated pojos.
JBoss 5 changed this usage and I am no longer able to create the entity manager (code below)
Object o = getJNDIResource(entityManagerName);
if(o instanceof org.jboss.ejb3.entity.InjectedEntityManagerFactory) { InjectedEntityManagerFactory factory = (InjectedEntityManagerFactory)o;
entityManager = factory.getEntityManager(); }
Clearly the package structure has changed but I have had no success in obtaining an EM that will recognize the fact that the domain objects do not have backing hbm.xml constructs but are only annotated.
This code worked in getting an EM, however the query resulted in no rows:
if(o instanceof org.jboss.jpa.injection.InjectedEntityManagerFactory) { org.jboss.jpa.injection.InjectedEntityManagerFactory factory = (org.jboss.jpa.injection.InjectedEntityManagerFactory)o;
entityManager = factory.createEntityManager(); }
Any help is repaid with cookies.
Peter
|