5 Replies Latest reply on Aug 2, 2006 12:42 PM by Gavin King

    Partial validation

    Guilherme Silveira Newbie

      I would like to know if there is any way to partially validate an object.

      For example, there is an update form responsible for updating just 3 out of 10 form fields... for now I have implemented this using Validator by my own. Something like:

      @IfInvalid(fields="myobj.field1, myobj.field2, myobj.field3", ...)

      There is also a problem that Hibernate validator does not give a method capable of validating a single field either recursively or not so I implemented the following algo:

      - split the field name ("myobj.field1")
      - grab the field value for each but the last string
      - for the last string: if the field has an @Valid, call hibernate validator validate method for the entire object pointed by this field, if it doesnt, its a simple property so call hibernate validator validate method on the previous class type and object using this specific field

      I want to know if there was something already done in this way or if I should have created a simple class to model this form although I really wouldnt like to do so..

      Guilherme Silveira