[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Does EntityManager injection work for JBoss 4.0.3SP1?????

darretta do-not-reply at jboss.com
Mon Nov 19 13:05:10 EST 2007


I have JBoss 4.0.3SPI with an EJB RC5 patch. I am able to deploy a Hibernate Entity Manager using persistence.xml, and even place it in JNDI. I can access the entity manager via JNDI, but cannot access using direct injection. My injection code is:

@PersistenceContext(unitName="vramPu") // I've tried with/without name
  | EntityManager em
  | 
  | ...
  | 
  | // Access em
  | em.<someMethod>
  | 

Each time I get an NPE.

Now, if I access via JNDI, it appears that I am now in BMP, since I need to add transactional behavior to the code. *Then*, there seems to be an issue with how this is done. Do I use UserTransaction, which requires javax.ejb.Resource which doesn't appear to be part of the RC5 specification???

I could really use some advice from anyone who has successfully used the hibernate entity manager with JBoss 4.0.3SP1. Thank you.

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106122



More information about the jboss-user mailing list