1 2 Previous Next 17 Replies Latest reply on May 5, 2007 5:07 AM by fabboco Go to original post
      • 15. Re: Nested conversations and transaction management
        christian.bauer

        You believe that there are nested transactions and that transactions span requests. These things do not happen or don't exist.

        It took me a while to realize that you actually wanted to say "persistence context" whenever you said "transaction", because that is what you are looking for.

        • 16. Re: Nested conversations and transaction management
          christian.bauer

          OK, last post from me, this is what you need:

          - A long-running conversation that is started when the form in 1) is rendered

          - A Seam-managed persistence context with @In EntityManager (read the docs) that is bound to that conversation (automatically)

          - The conversation should begin with FlushModeType.MANUAL, so that the persistence context does not write to the database until em.flush() is called

          - All your screens and popups run inside the same long-running conversation (JSF POSTback propagates the conversation, for opening a new window etc. and propagation during GET use s:link or s:button)

          - Use the @In EntityManager to load objects and queue objects for storing (unflushed)

          - If you want to cancel the whole thing, end the conversation without flushing the persistence context

          - If you want to commit the whole thing, call em.flush() in the request that also ends the conversation

          Finally, this is _not_ trivial although there is probably no framework that makes this easier than Seam. For example, I did not even mention the word "transaction", because what the TransactionalSeamPhaseListener is doing is just fine.

          • 17. Re: Nested conversations and transaction management
            fabboco

            Christian,

            thank you again.


            You believe that there are nested transactions and that transactions span requests. These things do not happen or don't exist.


            Your answers helped me to realize that this is not true.


            It took me a while to realize that you actually wanted to say "persistence context" whenever you said "transaction", because that is what you are looking for.


            If you call - do all or nothing - "persistence context" it is ok for me too.

            Anyway, following your answers I get to exactly:


            - A long-running conversation that is started when the form in 1) is rendered

            - A Seam-managed persistence context with @In EntityManager (read the docs) that is bound to that conversation (automatically)

            - The conversation should begin with FlushModeType.MANUAL, so that the persistence context does not write to the database until em.flush() is called

            - All your screens and popups run inside the same long-running conversation (JSF POSTback propagates the conversation, for opening a new window etc. and propagation during GET use s:link or s:button)

            - ....


            It is not working yet (my application is a little more complex of my description), but I think to be able to fix it myself.

            Tank you again.

            Regards

            Fab.

            1 2 Previous Next