if you dont need non-jta-datasource (openjpa.jdbc.SchemaFactory needs it) then it is not used so any datasource can be set.
the non-jta-datasource is set *by default* by tomee copying the closest datasource. First time it is the jta datasource since there is no non jta datasource but second time (2nd persistence unit) the closest is the previously created non jta datasource which lead to the behavior you report which is the one which is implemented/expected today. This is also why it is logged: to give the user the information some resources have been auto adjusted and can need attention. Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> 2016-01-11 14:15 GMT+01:00 tschuler <[email protected]>: > Hi Romain! > > Thanks for the hints. > If both jta- and non-jta-datasources are defined and referenced in > persistence.xml all works fine. > > Maybe you are interested in behaviour for different settings in > persistence.xml: > - Only jta-datasources are set and property openjpa.jdbc.SchemaFactory is > set: problem occurs as described above > - Only non-jta-datasources are set and property openjpa.jdbc.SchemaFactory > is set: problem occurs as described above > - Only jta-datasources are set and no property openjpa.jdbc.SchemaFactory: > works as expected > - Only non-jta-datasources are set and no property > openjpa.jdbc.SchemaFactory: similar (not same) problem occurs as described > above > > Best regards, > Thomas > > > > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/Multiple-EntityManager-using-wrong-Oracle-DataSource-tp4677399p4677404.html > Sent from the TomEE Dev mailing list archive at Nabble.com. >
