I have a web page with a table that is backed by a collection of domain objects. I need to enforce that the minDemand property of the bean is less than the maxDemand so in my controller, I test for this in my onBindAndValidate method :
The form correctly displays the error however I noticed the invalid values of bean are persisted to the database. I'm using Hibernate and OSIV and when I think about it, this would happen as the binding of values to the hibernate managed beans has already taken place and the txn commits due to OSIV.Code:if (minDemand > maxDemand) { errors.rejectValue("collection[" + i + "].minDemand", "bid.minDemandGTmaxDemand", "!The min demand should be less than or equal to the max demand!"); }
This is not the desired behavior. How do I cause the invalid bean values to be rejected/not persisted? (Note : I cant use client side validation).
Thanks,
Sanjiv


Reply With Quote