Announcement Announcement Module
No announcement yet.
validation logic and onBindAndValidate Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • validation logic and onBindAndValidate

    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 :

    if (minDemand > maxDemand)
      errors.rejectValue("collection[" + i + "].minDemand", "bid.minDemandGTmaxDemand", "!The min demand should be less than or equal to the max demand!");
    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.

    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).


  • #2
    I found out the cause for this. Details can be found in this thread

    Last edited by robyn; May 14th, 2006, 11:22 AM.