Hi Romain!

The wrong database connection usage only happens if both persistence units
are injected into a session bean.
It does not matter if jta or non-jta data sources are used.
Attached catalina log  catalina.log
<http://tomee-openejb.979440.n4.nabble.com/file/n4677401/catalina.log>  
including stack trace.

Digging deeper into the problem I can see that setting the persistence unit
property openjpa.jdbc.SchemaFactory is needed for provocating the problem:

  <persistence-unit name="my-unit1">
    <jta-data-source>myDatabase1</jta-data-source>
    <properties>
      *<property name="openjpa.jdbc.SchemaFactory"
value="native(ForeignKeys=true)" />*
    </properties>        
  </persistence-unit>
  <persistence-unit name="my-unit2">
    <jta-data-source>myDatabase2</jta-data-source>
    <properties>
      *<property name="openjpa.jdbc.SchemaFactory"
value="native(ForeignKeys=true)" />*
    </properties>        
  </persistence-unit>

Sorry for providing incomplete information at first.

Can anyone explain why setting the property causes usage of wrong database
connection for the second entity manager?

Best regards,
        Thomas



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

Reply via email to