Page 1 of 1

About Question enthuware.oce-jpad.v6.2.500 :

Posted: Tue Sep 25, 2018 6:20 pm
by __JJ__
Persistence context lives independently of a transaction.
The spec says (as you know of course):
The persistence context ends when the associated JTA transaction commits or rolls back, and all entities that were managed by the EntityManager become detached
Which means, when the transaction is no more, the pc is no more. So perhaps it's not quite correct to say the pc lives independently of a txn.

Ah, I should qualify, this means for a container-managed transaction scoped pc.

Re: About Question enthuware.oce-jpad.v6.2.500 :

Posted: Wed Sep 26, 2018 10:30 pm
by admin
Well, you are taking the statement out of context because the next sentence to the one that you have quoted says, "Though, usually, both exist at the same time. An EntityManager is usually created right after a transaction has begun. It ends when the method returns or for an application managed entity manager, when em.close(); is called."
Just because they exist during the same time doesn't mean one is dependent on the other.