[jboss-user] [JBoss Seam] - My list of questions: Seam validation, transactions and exte

beligum do-not-reply at jboss.com
Sat Jun 9 17:32:43 EDT 2007


Hi all,

I know this is a much-asked topic/question, but it would be cool if someone takes the time to explain a thing or two to me. Don't think I'm lazy; I've been reading up on this all day, I just need some clarification ;-)
I also hope this is the right forum to ask, since it's pretty much seam-specific, so please excuse me if it's not.

I have this very well documented scenario: a user clicks something he wants to edit, changes some things, and sends the changes back to the DB (the "multipage wizard pattern").

I have the following installed: a stateful session bean that keeps track of the object that is to be edited, an persistence context, a method that init's the edit-session and one that writes the changes to the db.
I begin a conversation in the init() method and load the selected object into a variable of the SSB. The conversation is ended in the update() method.

Now my questions:

0. If I inject (@In) my EntityManager in Seam, it holds an extended persistence context, right?

1. If I call merge() or not in the update() method, it doesn't make any difference, the changes are always written to the DB. Why is that?

2. I use seam-validation that checks my data, but when something goes wrong in the update() method, a rollbackException is thrown, but my changed data is still written to the DB. How come?

3. If I would like to solve the issue in question #2, if @Begin(flushMode=MANUAL) the only solution? If you have an answer here, please elaborate regarding @TransactionAttribute and @Rollback, because this is all but clear to me. For instance, why doesn't my @Rollback on the update() method work if something goes wrong in that method?

4. Is this solution: http://docs.jboss.org/ejb3/app-server/tutorial/extended_pc/extended.html the same as @Begin(flushMode=MANUAL)?

5. Is it normal I can't use <s:convertEntity /> if I use @PersistenceContext instead of an injected (@In) entity manager?

6. Is there a way to specify flushMode=MANUAL in the <begin-conversation> tag of pages.xml?

7. A bit of a general question: in my scenario (without the manual flushmode), where are the transactions started/ended, and where will throwing runtime exceptinos do any rollback on the changed data?

8. If I would like to post my findings of today in a wiki, what's the best one I can choose?

I hope I can help others out with my questions too, because this is supposed to be general knowledge, but it's hard to get your thoughts around these concepts if one comes from a non-ejb3 environment, directly to seam.

kudos to those who find the time and helpfulness to answer my questions.

b.

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

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



More information about the jboss-user mailing list