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

Moderator: admin

Post Reply
__JJ__
Posts: 125
Joined: Thu Jul 05, 2018 6:44 pm
Contact:

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

Post by __JJ__ » Tue Sep 25, 2018 6:20 pm

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.

admin
Site Admin
Posts: 7478
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin » Wed Sep 26, 2018 10:30 pm

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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests