Hi Fabiano,

first of all thank you for your valuable hint. I established an interceptor
CommitAwareInterceptor at the top of the interceptor stack. This interceptor
is tagging the JPA transaction for RollbackOnly in case of 

   a.) the action is not implementing CommitAware
   b.) the action is implementing CommitAware and the action's
implementation of isCommitable() is returning false.

These checks are performed at the latest step of of the request processing.
This implies that the view is rendered using the old model values i.e. the
old and maybe invalid model state. Every lazy loading is still working at
rendering time.

The only thing the OSIV-Filter has to do is to evaluate the transactions
RollbackOnly-Flag and commit accordingly.

And voila, everything is working fine. Perfect control over the transaction,
no invalid values on the database and no unwanted commits regarding to a.)

Once again, thanks for your hint,
Tobias


Fabiano Franz wrote:
> 
> I had the same issue regarding Struts 2 validations and Hibernate/JPA
> flush. My solution:
> 
> Write an XWork Interceptor that is placed right after the validation
> interceptor on your stack. This interceptor checks the actionErrors and
> fieldErrors and, if any of them is not empty, performs a Hibernate/JPA
> session clear.
> 
> Best regards,
> 
> Fabiano Franz
> http://fabianofranz.com 
> http://literar.org 
> http://pribi.com.br 
>  
> 


-- 
View this message in context: 
http://www.nabble.com/ModelDriven-CRUD-validation-failure-still-causes-JPA-update-tp12987242p21062748.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to