0 Replies Latest reply on Jul 24, 2009 1:01 AM by Matt Higgins

    Null in SessionImpl accessing entityManager in an abstract class

    Matt Higgins Newbie

      The title says it all. I am getting a null pointer when accessing an entity manager from an abstract class. I have an abstract class where I inject an entityManager


      @In
      private EntityManager entityManager;


      I have a getter in this class to expose the entity manager to subclasses. I can call the getter in my concrete class and make use of the entity manager. However when call a function on the abstract class which makes use of the same entity manager I get an NPE


      java.lang.NullPointerException
      at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835)
      at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)
      at org.jboss.seam.persistence.EntityManagerProxy.find(EntityManagerProxy.java:87)
      at com.swarm.service.AbstractEntityService.findById(AbstractEntityService.java:22)


      I am guessing this has something to to with how sessions are opened and closed by the proxy. Any help on this would be great.