struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From taltun <>
Subject Re: Prevent persisting data when validation fails
Date Mon, 20 Jul 2009 17:43:57 GMT

Thank you very much!!

During my research, I remember some one solved the issue by creating an
Struts 2 intercepter. He placed the intercepter right after the
validationIntercepter. The job of the intercepter was to check if
getActionErrors or getFieldErrors collections was not empty than it closed
and flushed the entityManager. But he didn't specified what intercepter
method (before, inside or after the action was invoked) he implemented.

Do you think this is a solution ? 
Any disadvangages ?
What intercepter method do you think will be the correct one to implement?

Greg Lindholm-2 wrote:
>> By the way, how can I let JPA return a deatached object ?
>> I make use of which is attached to this message.
> See
> discussion but the answer seems to be use the Hibernate
> session.evict(object) method.
> It may be easier to do an EntityManager.clear() or close() when validation
> fails.  Of course this will only work if you only use manual validation
> with
> the validate() method, if you use declarative validation then you never
> get
> a chance to react when validation fails.
>   ( @Struts Experts: Is there any way to call an action method
> post-validation but before the result is taken so you can do some stuff
> when
> validation fails?  I know about PreResultListener but don't think it's
> what
> I want.)
>> What is the best way to copy a persistent object ? Using BeanUtil.copy or
> clone, etc?
> I guess you can use clone, but I always write a copy constructor for
> entity
> classes so I have more control over handling of references to other
> entities.

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message