• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Seam Transaction Management question - why two transactions

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to understand Seam Managed Transactions, where it runs two transactions during a request. I don't really get the purpose of the second transaction which is started prior to the RENDER_RESPONSE phase. If this phase just does reads for data mostly, what is the purpose of having a transaction bounding it? There is nothing to rollback since we are reading and not writing. Since we already have a transaction which bounds the JSF phases from RESTORE_VIEW to INVOKE_APPLICATION, if we have a exception within this timeframe that calls for rollback, we can just catch the exception and display a message to user saying the transaction failed. And since RENDER_RESPONSE phase happens after INVOKE_APPLICATION, I don't see the compelling need to start a second transaction within seam.

In addition, if we have a persistence context open and/or extended, we can still achieve lazy loading without this second transaction. Thus, what is the purpose of this second transaction? What issue is it trying to solve?

Below are some references, but analyis of them still do not yield answers. Am I missing something? Please help.

http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/transactions.html - 4.3 says you can read outside a transaction.
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic