[jboss-user] [JBoss Seam] - persist() / remove() at end of long running conversation?

m_hess do-not-reply at jboss.com
Fri Jan 5 08:27:32 EST 2007


Hi,

I´m experimenting with Seam Managed long running atomic conversations right now.  I succesfully managed to have changes made to existing entities get flushed when the @End method is called. This works fine so far and is conform to my understanding of a Seam Managed Transaction using  @Begin and @End Annotations.

My next step was to create a new entity during that conversation. To attach the new instance to the entityManager I´m using persist() (side note: tried merge() as well, no difference). What puzzles me, is that immediately when em.persist(myNewInstance) is called, an insert is happening (used the debugger to confirm this).

I tested some more, and so far I can say, that it´s only the insert that is happening at the time persist() is called. When I have also made changes to the already existing entities in the same conversation, they are still correctly updated at the end of the conversation, not before.

So I´m wondering - is creating new instances in a long running conversation a somewhat "invalid" approach?

A possible solution might be to put the new instances in some kind of collection and call persist on each of its members during the @End method. But maybe there is a more "automatic" way Seam provides?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3998252#3998252

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3998252




More information about the jboss-user mailing list