This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTA transaction or resource-local transaction.  RSS feed

 
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume the entity manager below:



Is this EntityManager in JTA transaction or resource-local transaction?

Please help.
 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. It depends on how your persistence.xml is configured - the attribute type of element persistence-context determines this. If it is omitted, it defaults to JTA in EE, and to RESOURCE_LOCAL in SE.
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is an application managed entity manager. The transaction type depends on the settings in the persistence.xml file:

<persistence-unit name="PU">
<persistence-unit name="PU" transaction-type="JTA">

declare an JTA transaction entity manager (tansaction-type="JTA" is default), while

<persistence-unit name="PU" transaction-type="RESOURCE_LOCAL">

declares a resource-local transaction entity manager.

 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for Raf and Ralph
 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ralph is right, I used wrong names for the element and attribute.
 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way (with fresh expressions from exam): It's good to have a clear understanding of the various types of entity managers (application managed vs. container managed, JTA vs. resource local transactions) and their persistence contexts (transaction scoped vs. extended).
 
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ralph Jaus wrote:By the way (with fresh expressions from exam): It's good to have a clear understanding of the various types of entity managers (application managed vs. container managed, JTA vs. resource local transactions) and their persistence contexts (transaction scoped vs. extended).



I agree with this completely! For understanding this, I recommend PRO EJB3 Book, Chapter 5. MUST READ!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!