2 Replies Latest reply on Oct 10, 2007 9:37 AM by venkatesh babu

    Hibernate validation and JSF lifecycle.

    venkatesh babu Newbie


      I was going through the first chapter of seam tutorials.
      There was a statement which said that you can use hibernate validators for data validation on entity beans.

      Here is the example:
      @NotNull @Length(min=5, max=15) (7)
      public String getPassword()
      return password;

      I have a query regarding this kind of validation.

      JSF has its own processValidations phase where it tries to validate data. If any error happens, a FacesException is thrown and the phase goes to RENDER_RESPONSE.

      Now, from the diagram shown, the entity bean seems to be called during the updateModel phase (and rightly so). But if we are going to add validators over here instead of the processValidations phase, how will JSF react to it?

      According to JSF, the data obtained from the client is correct and the data can be updated in the model bean(in this case the entity bean.) But if a validation error happens during the updateModelValues phase, how will JSF react to it? Is a FacesMessage added somewhere? Is an FacesExcpetion thrown?