Hi!

We use two Oracle database instances (user1 & user2) running on same
database server available through same service name:

<Resource id="myDatabase1" type="DataSource">
  JdbcDriver oracle.jdbc.OracleDriver
  JdbcUrl jdbc:oracle:thin://localhost:1521/ServiceName
  UserName user1
  Password password1
</Resource>
<Resource id="myDatabase2" type="DataSource">
  JdbcDriver oracle.jdbc.OracleDriver
  JdbcUrl jdbc:oracle:thin:@//localhost:1521/ServiceName
  UserName user2
  Password password2
</Resource>

In persistence.xml we define two persistence units:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"; version="1.0">
  <persistence-unit name="my-unit1">
    <jta-data-source>myDatabase1</jta-data-source>
  </persistence-unit>
  <persistence-unit name="my-unit2">
    <jta-data-source>myDatabase2</jta-data-source>
  </persistence-unit>
</persistence>

What we observe is that an EntityManager for the second persistence unit
(my-unit2) uses a database connection from the first data source myDatabase1
(instead of myDatabase2 as defined).
All works fine if different jdbc urls are used within tomee.xml (e.g.
different service names or different database server).

Does anyone know of a special setting that enforces usage of correct
datasource for configuration described above?

Best regards,
        Thomas



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Multiple-EntityManager-using-wrong-Oracle-DataSource-tp4677399.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Reply via email to