Hi,

What environment are you executing your code in? Is this a Java EE app? The easiest way is to put a DataSource into JNDI, configure your transaction manager appropriately, and put OpenJPA into "managed transaction" mode. In this configuration, the semantics of Connection delivery will be up to the DataSource implementation.

If you don't have a transaction manager handy, you can create a DataSource implementation that meets your semantics, and provide it to OpenJPA when you create your EntityManagerFactory.

-Patrick

On Jul 2, 2008, at 5:39 PM, [EMAIL PROTECTED] wrote:

Thanks very much for the joinTransaction() suggestion.
As for the other suggestion, could you provide more detail on how I could "make OpenJPA use [the existing JDBC connection] instead of opening one on
its own"? :-)
Thanks a lot!!








Pinaki Poddar <[EMAIL PROTECTED]>
07/02/2008 06:35 PM
Please respond to
users@openjpa.apache.org


To
users@openjpa.apache.org
cc

Subject
Re: Re-using an existing jdbc connection?







Hi,
 If OpenJPA is invoked in a managed transaction context,
EntityManager.joinTransaction() will make OpenJPA join the existing
transaction.
If there is no managed transaction then you can use a bound the existing JDBC connection to a thread and make OpenJPA use it instead of opening one
on its own.



--
View this message in context:
http://n2.nabble.com/Re-using-an-existing-jdbc-connection--tp210696p219975.html

Sent from the OpenJPA Users mailing list archive at Nabble.com.



--
Patrick Linskey
202 669 5907

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to