• 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

Seam Transaction Management question - why two transactions

 
Greenhorn
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.

Ref:
http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/transactions.html - 4.3 says you can read outside a transaction.
http://www.javaworld.com/javaworld/jw-05-2008/jw-05-spring-seam3.html?page=2
http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/seam/Seam_Reference_Guide/Seam_and_ObjectRelational_Mapping-Seam_managed_transactions.html
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic