0 Replies Latest reply on Sep 7, 2016 12:22 PM by anu8802

    Jboss 4.2.3 EntityManager Null

    anu8802
      1. Hi,

      I am upgrading EJB Entity Beans from version 2.1 to version 3.0 in Jboss 4.2.3GA. It has a plugin for EJB3.

      The issue is my session beans will still remain EJB 2.1 Session Beans. Wont be upgrading them.

      So When i try to access my EntityManager from my Session Bean (which is 2.1), its giving a Null.

      If i try to use EntityManagerFactory it gives an exception saying :

      javax.persistence.PersistenceException: No Persistence provider for EntityManager named EjbComponentPU.

      Is this even Possible in Jboss 4.2.3 GA. I am using java 6.

       

      Below is the Code i am calling from EJB 2.1 session Bean.

       

      public class TestBean implements SessionBean {

       

        //pass persistence unit to entityManager.

        @PersistenceContext(name="EjbComponentPU")

        private EntityManager entitymanager;

       

       

      Below is my Persistence.xml file in META-INF directory.

       

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

         <persistence-unit name="EjbComponentPU" transaction-type="JTA">

            <provider>org.hibernate.ejb.HibernatePersistence</provider>

            <jta-data-source>java:/testDS</jta-data-source>

             <exclude-unlisted-classes>false</exclude-unlisted-classes>

         </persistence-unit>

      </persistence>

       

      Thanks in advance for any help.