4 Replies Latest reply on Jul 28, 2012 11:21 PM by dvohra21

    Multiple persistence units not supported by OEPE

    Justin James
      Dear Friends -


      Oracle Enterprise Pack for Eclipse
      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.


      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">
           <persistence-unit name="PU2" transaction-type="JTA">