2 Replies Latest reply on Feb 25, 2009 4:15 PM by zwz mycoy

    validator annotation @NotNull doesn't work in seam

    zwz mycoy Newbie
      Hi,everybody:
         I'm using hibernate annotation validator with jseam.
      I annotated a pojo, for example:
      @NotNull
      @Range(min = 3, max = 100, message = "Age must be between 3 and 100")
      public int getAge() {
      return age;
      }

      public void setAge(int age) {
      this.age = age;
      }

      @NotNull
      @Email
        public String getEmail() {
      return email;
      }

        public void setEmail(String email) {
      this.email = email;
      }
        in the web page, used with jseam validate:
      <s:validateAll>
      <table>
        <tr>
          <td>Your age:</td>
          <td>
            <s:decorate>
              <h:inputText value="#{person.age}" size="15"/>
            </s:decorate>
          </td>
        </tr>

        <tr>
          <td>Email:</td>
          <td>
            <s:decorate>
              <h:inputText value="#{person.email}" size="15"/>
            </s:decorate>
          </td>
        </tr>
      </table>
      </s:validateAll>


        strangely, the @Email,@Pattern,@Range all work fine, but the @NotNull always refuses to work --- empty form can be submitted and produces exception: javax.ejb.EJBTransactionRolledbackException: validation failed.
        I have tried @NotEmpty, it's the same with @NotNull.
        Can anyone help me?
        I use jseam2.1.1 , jboss As 5 and the DB is Hypersonic
      Thanks.
      ``

      ``