0 Replies Latest reply on Feb 9, 2006 2:51 PM by Seth Young

    Problematic EJB3 persistence

    Seth Young Newbie

      Hi,

      I am using AS 4.0.3SP1 and I'm trying to deploy an ear which has annotated entity beans. I'm also wishing to use a specific datasource wherin lies the problem.

      If I deploy the ear with the following persistence.xml settings:

      <persistence-unit>
      <jta-data-source>java:/PIMSDS</jta-data-source>




      </persistence-unit>

      The ear deploys, jboss reports the below on startup:

      19:45:00,937 INFO [Ejb3Configuration] found EJB3 Entity bean: com.inwood.pims.model.ProcessSchedule
      19:45:02,189 INFO [Configuration] processing extends queue
      19:45:02,189 INFO [Configuration] etc..
      19:45:02,480 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.InjectedDataSourceConnectionProvider
      19:45:02,490 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
      19:45:02,500 INFO [SettingsFactory] RDBMS: HSQL Database Engine, version: 1.8.0
      19:45:02,500 INFO [SettingsFactory] JDBC driver: HSQL Database Engine Driver, version: 1.8.0
      19:45:02,630 INFO [Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
      19:45:02,700 INFO [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)


      The entity beans DO NOT return any rows from the following:
      @PersistenceContext
      protected EntityManager em;

      public Collection getPS() {
      javax.persistence.Query q = em.createQuery("from ProcessSchedule");

      return (Collection)q.getResultList();
      }



      So it looks like PIMSDS datasource (mysql db) isn't being used.

      I have changed a single line in the persistence.xml to:
      <persistence-unit name="pims" transaction-type="JTA">

      ... and entitymanager annotations to:
      @PersistenceContext(unitName="pims")
      protected EntityManager em;

      But this causes the following exception:
      Reason: java.lang.RuntimeException: unable to find: java:/managedEntityFactories/pims

      Any advice would be much appreciated.

      Best regards
      Seth