struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chase <ch...@osdev.org>
Subject Re: Fundamental flaw in Model-Driven?
Date Thu, 01 May 2008 05:04:04 GMT

> Adam Hardy wrote:
>
> the problem was spurious JPA updates - which can be avoided by putting 
> an interceptor in between the Validation and the Workflow 
> interceptors: all it should do is call EntityManager.clear().
>
> if (validationAwareAction.hasErrors()) getEntityManager().clear();
>
>
> Using the JPA extended persistence context (not EJB), the clear() will 
> eliminate any changes to the model before JPA comes to flush to the 
> db. I assume it would work in an EJB container too.
>
> Does that fit your situation, Eric?
Then wouldn't the following work?

    public void validate() {
        //any actual validation code here
       
        if(hasErrors()) {
            //clear EntityManager or fail transaction
        }
    }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message