5 Replies Latest reply on Oct 6, 2005 11:58 AM by Bill Burke

    persistence.xml and named entity manager...

    Venu Narla Newbie

      I have a pu-services.ejb3 archive i deploy with statless and entity beans. the meta-inf directory contains a persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <entity-manager>
       <name>PUEntityManager</name>
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:puDS</jta-data-source>
       <jar-file>pu-services.ejb3</jar-file>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <property name="hibernate.hbm2ddl.auto" value="update"/>
       <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
       </properties>
      </entity-manager>
      

      The data source puDS is a reference to a MySQL datasource which is seperately deployed in a file pu-mysql-ds.xml


      <datasources>
       <local-tx-datasource>
       <jndi-name>puDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/puDB</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>pusystem</user-name>
       <password>xxxxxx</password>
       </local-tx-datasource>
      </datasources>
      

      Also note that mysql driver archive is in the lib directory of the jboss server configuration.

      Problem: The datasource seems to deploy fine. and the stateless and entity beans also deploy fine.
      But the Entity manager with the name specified in the persistence.xml is not instantiated. JBoss displays a message "creating a default entity manager pu_services...

      Am i doing something wrong? Do i need to use a .par file for persistence.xml to be recognized? JBoss does not appear to throw any messages that indicate reading a persistence.xml and or any problems it has encountered.

      Any pointers are appreciated.