|Re: [eclipselink-users] JDBC connection, transaction and EntityManager...|
Well its complicated. If you are using a JTA EntityManager with a JTA Connection/DataSource/connection pool, then each JTA transaction will use a single JDBC connection and Oracle session. A JTA JDBC Connection returned from a JTA DataSource will use a different Oracle session for each JTA transaction. If you are not using JTA, then in EclipseLink the EntityManager will have a read and a write connection pool. The read connection pool will be used for any read, until the first write is triggered in the EntityManager transaction context (such as a flush(), or update-all, native-SQL query, etc.). Then a single JDBC connection (and Oracle session) from the write connection pool will be used for the duration of the EntityManager transaction. You can also force the EntityManager to always use a single write connection by setting the "eclipselink.jdbc.exclusive-connection.mode"="Always" persistence or EntityManager property. You can also use a read connection pool in JTA by setting the non-jta-datasource property. markus hahn wrote: > > > Hi, > Two short questions referring to relation between connection, transaction > and EntityManager and DB session: > > does the JDBC connection stay the same during one transaction started by a > EntityManager? And does a JDBC connection always operate on one DB session > (on Oracle Database)? > Thanks in advance, Markus > > > > ----- http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland http://www.eclipse.org/eclipselink/ EclipseLink , http://www.oracle.com/technology/products/ias/toplink/ TopLink Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink , http://wiki.oracle.com/page/TopLink TopLink Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , http://www.nabble.com/EclipseLink-f26430.html EclipseLink Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence -- View this message in context: http://old.nabble.com/JDBC-connection%2C-transaction-and-EntityManager...-tp28704457p28746080.html Sent from the EclipseLink - Users mailing list archive at Nabble.com.
Back to the top