3 Replies Latest reply on Jul 31, 2009 4:36 AM by joblini

    In which phase is seam validation executed?

    magix

      Hi everyone,


      in which JSF-phase is SEAM validation executed?


      I know that JSF-validation is executed in the process validation phase, but how can Seam validate in this phase if the model is not yet updated (will be done in the following phase update model) and the annotations for validation are on the model?


      On the other side I can use <a4j:support> with attribute bypassUpdates="true" and validation still works?


      How and when does Seam validation fire?


      Thanks
      Matthias

        • 1. Re: In which phase is seam validation executed?
          mrossix

          Interesting question ...

          • 2. Re: In which phase is seam validation executed?
            asookazian

            As per Core JSF book:



            The converted values are not immediately transmitted to the beans that make up the business logic.  Instead, they are first stored inside the component objects as local values.  After conversion, the local values are validated.

            If you are referring to Hibernate Validator annotations on the entity class methods, Seam forces JSF to evaluate those via <s:validate/> or <s:validateAll/> tags.


            Then there's the Seam @Validator annotation for custom validation which is associated with the value of the validator attribute on a JSF control.


            SiA:



            The Hibernate Validator validations are applied twice, once in the UI to provide the
            user feedback, thanks to the Hibernate Validator-JSF validator bridge registered by the
            <s:validateAll> component tag, and once before the entity is persisted to ensure no
            bad data ends up in the database. The model validations are applied alongside other
            validators registered with the input component.
            • 3. Re: In which phase is seam validation executed?
              joblini

              Hello Matthias,


              Hibernate validations are performed by s:validate during the JSF VALIDATE phase.  They are performed against the input values, not against values in the model. As you correctly point out, the model has not been updated yet. 


              The validations are again performed, this time by the entity manager (hibernate) when the entity is persisted or updated.  At this time, however, an exception is thrown if any validations fail.


              Regards, Ingo