tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cole Ferrier <cole.ferr...@gmail.com>
Subject Re: Different behavior - Tomee Plus 7.0.3 vs Tomee plume 7.0.3 - JTA managed database connections
Date Tue, 25 Apr 2017 18:27:05 GMT
After pounding my head for half a day, trying to build a demo that failed...
i think i figured it out.

when using eclipselink (plume)
if the first thing you do is use the entitymanager and you do a "write"
transaction, then you get the database connection to do something else with
the database, you get that "write" connection.

If you get the database connection first, or you only have ran what it
thinks are read only sql.. then your database connection and your jpa
connection are two different connections.

when using openjpa (tomee plus)
it behaves as i would expect, regardless of what you do or do first, both
the JPA and datasource are the same connection.

It looks like if you are using eclipselink/plume, if you edit yoru
persistence.xml and add:

<property name="eclipselink.jdbc.exclusive-connection.mode" 	value="Always"
/> 
<property name="eclipselink.jdbc.exclusive-connection.is-lazy"
value="false"/>

then you get the openjpa behavior.. and the behavior documented on 
http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager

i got the idea for that setting from:

https://wiki.eclipse.org/EclipseLink/Examples/JPA/Auditing
---

based on all of this. i'm not sure if i could call this a Tomee issue... i'm
curious what the jee spec says should happen...






--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Different-behavior-Tomee-Plus-7-0-3-vs-Tomee-plume-7-0-3-JTA-managed-database-connections-tp4681596p4681599.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Mime
View raw message