You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by 9902468 <vi...@cerion.fi> on 2008/08/05 09:53:33 UTC

T5 - Hibernate - Transaction confusion

Hi,

I'm trying to understand how transactions should be handled with the
@CommitAfter annotation.

I have a normal service interface (FormDAO) that is annotated with commit
afters, but what happens when

Pseudo code:
void onSave() {
  
  formDAO.saveForm(form);
  formDAO.updateValues(form, user);

}

and the later call to formDAO throws an exception? Is the first method's
transaction also rolled back, even if both methods have their own
@CommitAfter annotations?

The documentation doesn't specify whether the transaction is rolled back if
there is one successfull @CommitAfter and one failed.

Is the correct approach to wrap multiple service calls in to one and
annotate only this?

 -99
-- 
View this message in context: http://www.nabble.com/T5---Hibernate---Transaction-confusion-tp18826235p18826235.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 - Hibernate - Transaction confusion

Posted by 9902468 <vi...@cerion.fi>.
I read the source code and it seems that the @CommitAfter really is used to
mark the method and then each method is decorated: thus each method call
gets committed separately. Am I right?

 -99


9902468 wrote:
> 
> Hi,
> 
> I'm trying to understand how transactions should be handled with the
> @CommitAfter annotation.
> 
> I have a normal service interface (FormDAO) that is annotated with commit
> afters, but what happens when
> 
> Pseudo code:
> void onSave() {
>   
>   formDAO.saveForm(form);
>   formDAO.updateValues(form, user);
> 
> }
> 
> and the later call to formDAO throws an exception? Is the first method's
> transaction also rolled back, even if both methods have their own
> @CommitAfter annotations?
> 
> The documentation doesn't specify whether the transaction is rolled back
> if there is one successfull @CommitAfter and one failed.
> 
> Is the correct approach to wrap multiple service calls in to one and
> annotate only this?
> 
>  -99
> 

-- 
View this message in context: http://www.nabble.com/T5---Hibernate---Transaction-confusion-tp18826235p18826733.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 - Hibernate - Transaction confusion

Posted by Angelo Chen <an...@yahoo.com.hk>.
I think it rolls back only updateValues.  I'd prefer to put several method
calls under one transaction. 




9902468 wrote:
> 
> Hi,
> 
> I'm trying to understand how transactions should be handled with the
> @CommitAfter annotation.
> 
> I have a normal service interface (FormDAO) that is annotated with commit
> afters, but what happens when
> 
> Pseudo code:
> void onSave() {
>   
>   formDAO.saveForm(form);
>   formDAO.updateValues(form, user);
> 
> }
> 
> and the later call to formDAO throws an exception? Is the first method's
> transaction also rolled back, even if both methods have their own
> @CommitAfter annotations?
> 
> The documentation doesn't specify whether the transaction is rolled back
> if there is one successfull @CommitAfter and one failed.
> 
> Is the correct approach to wrap multiple service calls in to one and
> annotate only this?
> 
>  -99
> 

-- 
View this message in context: http://www.nabble.com/T5---Hibernate---Transaction-confusion-tp18826235p18826695.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org