4 Replies Latest reply: Jul 28, 2012 6:21 PM by dvohra21 RSS

    Multiple persistence units not supported by OEPE 12.1.1.0.1

    Justin James
      Dear Friends -

      Environment

      Oracle Enterprise Pack for Eclipse 12.1.1.0.1
      JPA version : 2.0
      Platform : Eclipse link 2.3.x
      OWLS Version : 12c (12.1.1)
      JDK : jrockit1.6
      Sybase database.

      While developing JPA projects, we are getting error and warning while using Multiple persistence units in persistence.xml.

      Steps :

      1. Create 2 persistence unit in persistence.xml.
      -- Warning saying that "Multiple persistence units defined - only the first persistence unit will be recognized"

      2. Create 2 database connection in OEPE.

      3. Create JPA Entities from Table using first database connection.
      -- No issues.

      4. Create another JPA Entities from Table using second database connection.
      -- Issue is entities created in step3.(is first JPA Entity classes)
      -- Errors from first JPA Entity classes.
      ----1. Table "table_name1" cannot be resolved.
      ----2. Table "table_name1" for column "column_name1" is not valid for this entity.

      5. Second JPA Entity classes are fine.

      Thanks
      Justin.

      Sample persistence.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence version="2.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_2_0.xsd">
           <persistence-unit name="PU1" transaction-type="JTA">
                <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
                <jta-data-source>DS1</jta-data-source>
                <class>com.test.FirstEntity</class>     
           </persistence-unit>
           
           <persistence-unit name="PU2" transaction-type="JTA">
                <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
                <jta-data-source>DS2</jta-data-source>
                <class>com.test.SecondEntity</class>
           </persistence-unit>
      </persistence>