Re: Prevent persisting data when validation fails

2009-07-20 Thread Burton Rhodes
I had the same problem while using the opensessioninview pattern. Since this pattern in struts uses an interceptor, in the OSiV interceptor I checked to see if validation had failed in an Action. If so, I "rolled back" the transaction to make sure it didn't persist the data. I eventually removed t

Re: Prevent persisting data when validation fails

2009-07-20 Thread Greg Lindholm
> 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 tha

Re: Prevent persisting data when validation fails

2009-07-20 Thread taltun
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 close

Re: Prevent persisting data when validation fails

2009-07-20 Thread Greg Lindholm
> > By the way, how can I let JPA return a deatached object ? > > I make use of GenericDaoJpa.java which is attached to this message. > http://www.nabble.com/file/p24571326/GenericDaoJpa.java GenericDaoJpa.java > > > See http://stackoverflow.com/questions/31446/detach-an-entity-from-jpa-ejb3-persis

Re: Prevent persisting data when validation fails

2009-07-20 Thread taltun
By the way, how can I let JPA return a deatached object ? I make use of GenericDaoJpa.java which is attached to this message. http://www.nabble.com/file/p24571326/GenericDaoJpa.java GenericDaoJpa.java Greg Lindholm-2 wrote: > >> I use JPA (hibernate) to persist. >> >> >> >> An example of acti

Re: Prevent persisting data when validation fails

2009-07-20 Thread taltun
Ok. - What is the best way to copy a persistent object ? Using BeanUtil.copy or clone, etc? Greg Lindholm-2 wrote: > >> I use JPA (hibernate) to persist. >> >> >> >> An example of action that use prepare to load a person object from >> transactional manager. When the validate fails and it r

Re: Prevent persisting data when validation fails

2009-07-20 Thread Greg Lindholm
> I use JPA (hibernate) to persist. > > > > An example of action that use prepare to load a person object from > transactional manager. When the validate fails and it return back to the > input page the request ends and the transaction persists the dirty user > object to database. The dirty user ob

Re: Prevent persisting data when validation fails

2009-07-20 Thread taltun
I use JPA (hibernate) to persist. An example of action that use prepare to load a person object from transactional manager. When the validate fails and it return back to the input page the request ends and the transaction persists the dirty user object to database. The dirty user object should

Re: Prevent persisting data when validation fails

2009-07-20 Thread Jim Kiley
What are you using to manage persistence? Can we see your action's source code? On Mon, Jul 20, 2009 at 5:42 AM, taltun wrote: > > When submitting a form using manual validation in my action. Even when the > validation fails and the action method supposed to be called is not called > at all, th