After playing with the example from Chapter 6 : A Simple Stateful Application, I decided to change the ManagerAction class from a session scoped variable to a conversation scoped variable.
I changed "@Scope(SESSION)" to "@Scope(CONVERSATION)", added a "@Begin" to the "sayHello()" method, and added "@End" to the "startOver()" method and redeployed.
I had breakpoints set inside the sayHello and startOver methods and was debugging in Eclipse Europa. I wanted to watch the memory addresses of the ManagerAction over multiple submits to verify that different browser tabs would spawn different conversations.
The change didn't work. I got,
14:22:29,544 FATAL [application] javax.ejb.EJBException: java.lang.IllegalStateException: begin method invoked from a long running conversation, try using @Begin(join=true) on method: sayHello
I decided to follow the error message's advice. It worked -- nice error message!
I started two conversations in two browser tabs, the urls displayed differenct conversation ids, and Eclipse showed different memory addresses when I hit the breakpoints. However, when I entered different one word names, "Bill" and "Mickey" (I was listening to DeadPod) and tried different responses to the prompt, I encountered a problem. When I would choose the "Oops, let me go back and change" option the name would be the same in both windows.
I checked the Person object, and it was session scoped. I removed the @Scope annotation and everything worked as expected.
Hibernate often throw nice error messages, and I'm glad to see that has been carried over to Seam. Nice work!
Blogged with Flock