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