Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 42417 invoked from network); 2 Jun 2010 19:50:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Jun 2010 19:50:21 -0000 Received: (qmail 77492 invoked by uid 500); 2 Jun 2010 19:50:21 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 77367 invoked by uid 500); 2 Jun 2010 19:50:20 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 77357 invoked by uid 99); 2 Jun 2010 19:50:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jun 2010 19:50:20 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [148.87.113.121] (HELO rcsinet10.oracle.com) (148.87.113.121) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jun 2010 19:50:12 +0000 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o52JnnBH023151 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Jun 2010 19:49:51 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o52BRPGo016961 for ; Wed, 2 Jun 2010 19:49:48 GMT Received: from abhmt018.oracle.com by acsmt353.oracle.com with ESMTP id 291376721275508158; Wed, 02 Jun 2010 12:49:18 -0700 Received: from 80-254-68-36.dynamic.monzoon.net (/80.254.68.36) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 02 Jun 2010 12:49:18 -0700 Message-Id: From: Craig L Russell To: users@openjpa.apache.org In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Subject: Re: Can entity manager join jdbc transaction? Mime-Version: 1.0 (Apple Message framework v936) Date: Wed, 2 Jun 2010 12:49:15 -0700 References: X-Mailer: Apple Mail (2.936) X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090205.4C06B5DF.00E3:SCFMA922111,ss=1,fgs=0 X-Virus-Checked: Checked by ClamAV on apache.org Hi, You might consider turning this upside down and first starting a JPA transaction and then get the connection from OpenJPA to do your JDBC work. Then both JPA and your JDBC code would be working with the same connection. Craig On Jun 2, 2010, at 8:43 AM, Daryl Stultz wrote: > Hello, my project has a lot of work done direct to JDBC and some new > work > done through OpenJPA. I'm using 1.2.1 on Tomcat (non-container). I > have a > situation where a JDBC connection is obtained and a transaction is > started. > Then some OpenJPA querying is done. The Entity Manager obtains an > independent connection which means it doesn't read the state with > respect to > the JDBC transaction. Is there any way to get an Entity Manager to > join a > JDBC transaction? My setup uses a DataSource to supply a connection > to the > Entity Manager. It seems I could modify this to return the JDBC > connection, > but I'm guessing the EM would close it before my JDBC operation is > done. > > Thanks. > > -- > Daryl Stultz > _____________________________________ > 6 Degrees Software and Consulting, Inc. > http://www.6degrees.com > http://www.opentempo.com > mailto:daryl.stultz@opentempo.com Craig L Russell Architect, Oracle http://db.apache.org/jdo 408 276-5638 mailto:Craig.Russell@oracle.com P.S. A good JDO? O, Gasp!