0 Replies Latest reply on Nov 19, 2007 1:05 PM by Mike Darretta

    Does EntityManager injection work for JBoss 4.0.3SP1?????

    Mike Darretta Newbie

      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.