Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 4608 invoked from network); 9 Aug 2006 00:38:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Aug 2006 00:38:40 -0000 Received: (qmail 76580 invoked by uid 500); 9 Aug 2006 00:38:38 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 76549 invoked by uid 500); 9 Aug 2006 00:38:38 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 76534 invoked by uid 99); 9 Aug 2006 00:38:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Aug 2006 17:38:37 -0700 X-ASF-Spam-Status: No, hits=2.8 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [68.142.206.236] (HELO smtp103.plus.mail.mud.yahoo.com) (68.142.206.236) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 08 Aug 2006 17:38:37 -0700 Received: (qmail 81306 invoked from network); 9 Aug 2006 00:38:16 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:Mime-Version:In-Reply-To:References:Content-Type:Message-Id:Content-Transfer-Encoding:From:Subject:Date:To:X-Mailer; b=YB/ssYbKS9/gsqaXjkB0wM+uBAI7S4FzMyIt9Ha4Q+U6cKoNJ1WOJFQzQhU8opULEQ/x6GD0LWbiw4BaB+QZgA5ZLGaIymjSU0BQLXCqcrzriLLl7HisV9yYFF6RIqDtjasATVE0TBfbUKrCL/sjboBmvSmkIGzcFbgByXCrjIo= ; Received: from unknown (HELO ?10.11.55.8?) (david?jencks@63.105.20.225 with plain) by smtp103.plus.mail.mud.yahoo.com with SMTP; 9 Aug 2006 00:38:15 -0000 Mime-Version: 1.0 (Apple Message framework v749.3) In-Reply-To: <35080D88-EB99-41D7-BB62-01641060599F@iq80.com> References: <74e15baa0608081628l653e7c79yaa102a310fda9e36@mail.gmail.com> <35080D88-EB99-41D7-BB62-01641060599F@iq80.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <5466DE4D-E6D0-4275-AC06-FD02B8EC716B@yahoo.com> Content-Transfer-Encoding: 7bit From: David Jencks Subject: Re: Transactions and DB Pools in JPA Date: Tue, 8 Aug 2006 17:38:05 -0700 To: dev@geronimo.apache.org X-Mailer: Apple Mail (2.749.3) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Aug 8, 2006, at 5:27 PM, Dain Sundstrom wrote: > If this is for 1.1, you need to demarcate the transactions using > the TransactionContextManager. I suggest you take a look at the > OnlineUserTransaction for a good example. IMNSHO container managed jta aint gonna work for 1.1 since it NEEDS the new jta interface to be able to flush the cache before the tx commits. App managed JPA ought to be ok, just stay away from jta. As dblevins said, the jpa implementation will be managing the tx locally on the jdbc connection by turning off autocommit and ending the tx with conn.commit(). This should all work fine (even with a localtx or xa pool) so long as you don't have any jta activity in sight. As soon as you start an jta tx the jdbc resource adapter ought to start complaining vociferously. thanks david jencks > > -dain > > On Aug 8, 2006, at 4:28 PM, Aaron Mulder wrote: > >> OK, so for this JPA plugin, the goal is to support application- >> managed >> JPA for web apps. >> >> It looks like a JPA EntityManager has a call to getTransaction >> returning an EntityTransaction which you can used to begin and commit >> transactions in the non-JTA case (which, for now, let's assume this >> would be). >> >> So I'm thinking the code would look like this: >> >> EntityManager mgr = ... >> EntityTransaction tx = mgr.getTransaction(); >> tx.begin(); >> // save some JPA changes >> tx.commit(); >> >> There was a comment that we shouldn't used Geronimo DB pools with >> JPA, >> which I don't follow. What is the suggested way to hook the JPA >> provider up to the database? It looks like you provide a >> PersistenceUnitInto with methods getJtaDataSource and >> getNonJtaDataSource... I don't know which one of these a Geronimo DB >> pool would be. Does it depend on whether the pool claims to support >> none, local, or XA transactions? >> >> Also, I guess I need to figure out whether we could be in the JTA >> case >> -- I'm not sure if supplying a JTA DataSource is enough. Maybe then >> the code would look like this: >> >> UserTransaction tx = ... >> tx.begin(); >> // save some JPA changes >> tx.commit(); >> >> I'll keep reading the JPA spec, but in the mean time, if anyone has a >> full understanding of this, some insight would be great. >> >> Thanks, >> Aaron >