geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Mulder" <>
Subject Transactions and DB Pools in JPA
Date Tue, 08 Aug 2006 23:28:40 GMT
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();
// save some JPA changes

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 = ...
// save some JPA changes

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.


View raw message