geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <>
Subject Re: Transactions and DB Pools in JPA
Date Wed, 09 Aug 2006 00:27:59 GMT
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.


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

View raw message