9 Replies Latest reply on Dec 2, 2009 12:00 AM by Arbi Sookazian

    Hibernate Validator on non-entity seam backing beans

    Bogdan Minciu Newbie


      I would like to use Hibernate Validator on some non-entity Seam backing beans. So, I have this bean:

      public class CreateProductBean implements LocalCreateProduct {
          @Length(min = 3)
          private String productName;
          @Length(min = 9)
          private String productCode;
          public CreateProductBean() {
      //getters and setters omited
          public void remove() {
          public String toString() {
              return null;
          public boolean equals(Object o) {
              return false;

      and this facelet page:

          <h:messages globalOnly="true" styleClass="message"/>
          <s:decorate id="productNameDecorate" template="layout/edit.xhtml">
              <ui:define name="label">Product name: </ui:define>
              <h:inputText id="productName" value="#{productCreate.productName}"/>
          <s:decorate id="productCodeDecorate" template="layout/edit.xhtml">
              <ui:define name="label">Product code: </ui:define>
              <h:inputText id="productCode" value="#{productCreate.productCode}"/>
          <h:commandButton id="ok" value="Create Product" />

      The edit.xhtml template is the generated one. When the form is submitted, the validation process seems not to be reached. There is no validation-failed message; the fields are reported as valid.

      Is it possible to use Hibernate Validator on simple, non-entity Seam backing beans like the one above? What am I missing? Any help would be highly appreciated.

      Many thanks in advance,