0 Replies Latest reply on Apr 6, 2006 8:48 AM by none of your business

    define transaction lookup, injectio of EntityManager

    none of your business Newbie

      Hi everybody!

      I've got 2 problems I'd like to helped with.

      I'm just startet working with JBoss and I'm using the 4.0.4RC1 version of it. During the start up i get the following warning output:

      WARN [TreeCache] No transaction manager lookup class has been defined. Transactions cannot be used

      1.) Now where can I define this transaction manager look up class?

      And I'm trying to inject an EntityManager into a stateless Session Bean. However, I don't get an instance of it. I've written a persistence.xml file :

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
       <persistence-unit name="persistenceSample">
       <property name="hibernate.dialect"
       value="org.hibernate.dialect.HSQLDialect" />
       <property name="hibernate.hbm2ddl.auto" value="create-drop" />

      And in the bean class I'm trying to inject an EntityManager by
      private EntityManager manager;

      But, I already get a Waring from JBoss when deploying the beans, which I've put into a jar file.

      WARN [ServiceController] Problem starting service persistence.units:jar=DistSampleBeans.jar.jar,unitName=persistenceSample
      ... lots of method names where the exception goes up the call stack ...

      Does this have something to do with the fact that no Transaction Manager look-up class has been defined?

      I tried to get an instance of the EntityManager by using an EntityManagerFactory as well:
      Map<String, String> properties = new HashMap<String, String>();
      EntityManagerFactory emf = Persistence
       .createEntityManagerFactory("persistenceSample", properties);
      EntityManager manager = emf.getEntityManager();

      Either with or without the properties Map --> no success. The outcome is a NullPointerException.

      2.) What am I doing wrong?