0 Replies Latest reply on Aug 9, 2007 11:26 AM by dapeng wang

    Transaction Handling in Seam + Spring

    dapeng wang Newbie


      for a new application, I plan to use use a layered architecture based one seam + spring + hibernate. Because of some SOA requirements I choose such a layered architecture, so that spring service beans can be used to serve user interface and service interface requests.

      I am now not sure about the best strategy to handle the transaction in this architecture. Until now, I use Spring AOP with @Transactional annotation to mark the transaction boundary. As far as I understand, this has the shortcoming of LayzInitializationException in JSF render response phase. Seam's solution is the TransactionalSeamPhaseListener, which starts 2 separate txs, one spanning update model and invoke application and one spanning render response. I have the following questions:
      1. In case of redirect, the second tx will then span the new http request, which contains only the render response phase?
      2. If the tx is already started by the PhaseListener, why does the spring example of Seam 2.0 still contains @Transactional annotation in spring beans? Is that only good for invocation outside of Seam, like WS?
      3. Is that a good strategy to have both the PhaseListener and @Transactional annotation activated, so that one can handle JSF requests for GUI and the other can handle web service requests?

      Any feedback is appreciated.