2 Replies Latest reply on Apr 18, 2008 4:46 PM by schlegel

    Hibernate Validator (complex type)

    graben

      I recognized that seam handels validations after sending jsf form but before invoking methods on beans. well, that's working fine for geter based annotations. I'm trying to use self written validators which are defined as class annotations since they correspond to several entity columns (complex constraints checks). Unfortunately these validations are done after method has been ended. I got an validation error which is handeled by seam but which also stops transaction. Another commit after correcting form input fails. I know that there is not yet a possibility for that transaction problem, but there might be an anwser how to check class validations togeter with field annotations. Maybe that's an feature/bug request for JIRA!


      THX any for help
      Benjamin

        • 1. Re: Hibernate Validator (complex type)
          schlegel

          Why you don't call


          InvalidValue[] badValues = classValidator.getInvalidValues(o);



          in your Action-Methods and if errors are available you generate FacesMessages and return null from the action-method?


          It is not possible to check multiple values in the validate phase.

          • 2. Re: Hibernate Validator (complex type)
            schlegel

            I mean...



            ClassValidator classValidator = Validators.instance().getValidator(o.getClass());
            
                            if (classValidator.hasValidationRules()) {
                                InvalidValue[] badValues = classValidator.getInvalidValues(o);
            ....