• 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

Transaction-propagation

 
Ranch Hand
Posts: 109
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ranchers,

I have a doubt regarding transaction-propagation.

In a session-bean a method is started with the tx-attribute RequiresNew. This method calls an application-service (a POJO). The application-service contains business-logik and calls an entity-bean for persistence. The methods in the entity-bean have all the tx-attribute Mandatory.

Does the transaction from the session-bean-method (created with RequiresNew) will be propagated through the POJO-application-service to the entity-bean?

Is the POJO be able to rollback the transaction?

When the session-bean would be directly call the entity-bean, it would be clear, that the transaction will be propagated from the session-bean to the entity-bean. But what happens if there is a POJO between session-bean and entity-bean?

Regards,
Oliver
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Oliver,
Transaction contexts are stored in thread local variables.
So, if the POJO does not spawn a new thread(not allowed as per ejb specs) and call the entity bean in that thread, the transaction context will be propagated to the entity bean.

Will the POJO be able to rollback the transaction?


Yes, if the session bean provides it with its user transaction object(BMT) OR session context object(CMT).
 
Oliver Rensen
Ranch Hand
Posts: 109
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nitesh, thanks a lot for your help.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic