• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTA Transaction Mangement

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

In terms of the JTA, what is the significant difference between a Transaction synchronization and Transaction association? Both to me sems lile associating a PersistenceContext with an active transaction. Did I get this right?
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Transaction synchronization means that the entity manager registers at the JTA transaction and will be informed from the transaction when a commit or rollback occurs. Every entity manager type (container-managed as well as application-managed) and any number of entity managers can be synchronized with the transaction.

Transaction Association has to do with sharing a persistence context and affects only container-managed entity managers: The first container-managed entity manager em1 those methods are called within a JTA transaction associates its persistence context with this transaction. If a method of a second container-managed entity manager em2 is called within the same transaction afterwards, em2 realizes that there is alreday an persistence context associated with the transaction. Therefore em2 won't create a new persistence context but uses the one from em1 instead. So em1 and em2 share the same persistence context. At most one persistence context can be associated with a JTA transaction.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That sounds reasonable. Thanks!
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"The first container-managed entity manager em1 those methods are called within a JTA transaction associates its persistence context with this transaction. If a method of a second container-managed entity manager em2 is called within the same transaction afterwards, em2 realizes that there is alreday an persistence context associated with the transaction. Therefore em2 won't create a new persistence context but uses the one from em1 instead. So em1 and em2 share the same persistence context. At most one persistence context can be associated with a JTA transaction."

is it correct to say if persistent context will be propagated to another method only if the persistenceContext name are same because what if both the method have different context.
 
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

nitin pokhriyal wrote:
is it correct to say if persistent context will be propagated to another method only if the persistenceContext name are same because what if both the method have different context.



You mean the persistence unit name, right?
 
nitin pokhriyal
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no i mean by persistence context as i was quoting ralph's comment.
 
reply
    Bookmark Topic Watch Topic
  • New Topic