1 Reply Latest reply on Apr 12, 2006 10:01 AM by George V

    Entity Manager is null in session bean (jboss 4.0.4 CR2)

    George V Newbie

      I am trying to use jboss 4.0.4CR2 with the ejb3 option but at the moment
      when I try to use an EntityManager from within my session bean the entity
      manager is always null.

      I have a stateless session bean where I load the entity manager:

      public class CategorySessionBean implements CategoryView {
       @PersistenceContext(unitName = "inventPU")
       protected EntityManager manager;
       public load(){
       //HERE THE manager is NULL
       Query q = manager.createQuery("FROM Category");

      I am deploying the application in an ear with the following structure:


      ...|-gr (the entity and session beans)

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence-unit name="inventPU">
      <description> AEGEK invent pesrsistent unit</description>
      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
      <property name="hibernate.hbm2ddl.auto" value="create"/>

      (jsp and other web related stuff)

      Thanx ...