0 Replies Latest reply on Jun 2, 2009 5:02 PM by Nirav Assar

    Seam Transaction Management question - why two transactions

    Nirav Assar Newbie
      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.

      [My Link=>http://docs.jboss.org/hibernate/stable/entitymanag...ence/en/html/transactions.html]  4.3 says you can read outside a transaction.
      [My Link=>http://www.javaworld.com/javaworld/jw-05-2008/jw-05-spring-seam3.html?page=2]
      [My Link=>http://www.redhat.com/docs/manuals/jboss/jboss-eap...Seam_managed_transactions.html]