Regarding the relationship of the EntityManager to a Transaction: since there
is a one-to-one EntityManager-to-Transaction relationship, and we will only
have one EntityManager, it seems that, for us, transactions will be similar
to flush?

Assuming we have two Entities, a and b,

// modify A outside 'transaction'
a.setFoo...

EntityTransaction t = em.getTransaction();
t.begin();
// modify B inside transaction
b.setBar...
t.commit(); // commits changes to a and b
-or-
t.rollback(); // rolls back changes to a and b


Is this correct?

If this is correct, why does 'flush' need a transaction?
(EntityManager.flush throws TransactionRequiredException otherwise)



-- 
View this message in context: 
http://www.nabble.com/Extended-Persistence-Context-in-multi-threaded-app-tp15160167p15164994.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to