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 not be persisted if the validation fails.: public class PersonAction extends BaseAction implements Preparable { private PersonManager personManager; private Person person; public void prepare() { person = personManager.getPerson(id); } public String savePerson() { manager.savePerson(person); return SUCCESS; } public void validate() { if (person.firstName.length < 5 and person.firstName > 10) { addActionError("Firstname length should be between 5 and 10 characters."); } } } 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, the dirty data is persisted ? > > How can I prevent data from being persisted if the validation fails ? > > Note: I use prepare method to load e.g an user object from a > manager/service. And the data relates to the user object that is about. > > -taltun > -- View this message in context: http://www.nabble.com/Prevent-persisting-data-when-validation-fails-tp24566713p24569948.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