Now I am really confused.
First of all let me update the sample code.
| @Stateful
| @Name("A")
| @Scope(ScopeType.CONVERSATION)
| public class ABean implements Serializable, A
| {
| @In
| private EntityManager em;
|
| @In(create = true)
| @Out(required = false)
| A a; // A entity bean
|
| @End(beforeRedirect=true)
| @Rollback
| public String cancel()
| {
| return "/AList.xhtml";
| }
|
|
| @Begin(nested=true)
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String initCreate()
| {
| ....
|
| a = new A();
|
| return "/A.xhtml";
| }
|
| @End(beforeRedirect=true)
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String processCreate()
| {
| ....
|
| a = em.merge(a);
|
| return "/ListA.xhtml";
| }
| }
|
I have traced what happens at database level and I discovered that the database
transaction is started at the merge statement and committed after that the
method is ended. I presumed at the end of the conversation.
SURPRISE - SURPRISE !!!
I removed @End(beforeRedirect=true) from the processCreate() method.
The database transaction is STILL started at the merge statement and STILL
committed after that the method is ended.
What is going on ? I thought that using a long-running conversation I was able
to manage more http requests before actually write to the database and I
thought that the database transaction was committed only at the end of the
method annotated with @End.
Probably I am wrong !
Please, can anyone explain to me which is the relationship between conversation
and transaction ? Is this stuff documented somewhere ?
Thanks
Regards
Fab.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042245#4042245
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042245
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user