[jboss-user] [JBoss Seam] - Re: Nested conversations and transaction management
christian.bauer@jboss.com
do-not-reply at jboss.com
Sat May 5 03:44:27 EDT 2007
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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043418#4043418
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043418
More information about the jboss-user
mailing list