PS: i see a single datasource:

Jan 11, 2016 12:19:25 PM org.apache.openejb.config.AutoConfig
logAutoCreateResource
INFO: Auto-creating a Resource with id 'myDatabaseJta' of type
'DataSource for 'my-unit'.
Jan 11, 2016 12:19:25 PM org.apache.openejb.config.AutoConfig deploy
INFO: Configuring Service(id=myDatabaseJta, type=Resource,
provider-id=myDatabase)
Jan 11, 2016 12:19:25 PM
org.apache.openejb.assembler.classic.Assembler createRecipe
INFO: Creating Resource(id=myDatabaseJta)
Jan 11, 2016 12:19:25 PM
org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource readOnly
INFO: Disabling testOnBorrow since no validation query is provided
Jan 11, 2016 12:19:25 PM org.apache.openejb.config.AutoConfig setJtaDataSource
INFO: Adjusting PersistenceUnit my-unit <jta-data-source> to Resource
ID 'myDatabaseJta' from 'null'
Jan 11, 2016 12:19:25 PM org.apache.openejb.config.AutoConfig deploy
INFO: Configuring PersistenceUnit(name=my-unit2)
Jan 11, 2016 12:19:25 PM org.apache.openejb.config.AutoConfig setJtaDataSource
INFO: Adjusting PersistenceUnit my-unit2 <jta-data-source> to Resource
ID 'myDatabaseJta' from 'null'



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 13:05 GMT+01:00 Romain Manni-Bucau <[email protected]>:

> I guess it is the non jta database auto setting, can you duplicate your
> datasource set JtaManaged = false in the copies and set them on
> non-jta-datasource in both persistence units?
>
>
> 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 12:42 GMT+01:00 tschuler <[email protected]>:
>
>> 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