struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <>
Subject Re: Prevent persisting data when validation fails
Date Mon, 20 Jul 2009 15:32:32 GMT
> By the way, how can I let JPA return a deatached object ?
> I make use of which is attached to this message.
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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message