3 Replies Latest reply on Dec 8, 2009 8:18 AM by Yashwanth Gardas

    Hibernate validations on seam components

    Yashwanth Gardas Newbie
      The problem I'm facing goes like this:

      There are two classes ClassOne and ClassTwo.

      @Name("classone")
      @Scope(ScopeType.CONVERSATION)
      @Entity
      @AutoCreate
      @Table(name = "classone", schema = "demo")
      @Inheritance(strategy = InheritanceType.JOINED)
      public class ClassOne implements Serializable {

        public ClassOne() {
          this.classTwo= new ClassTwo();
        }

        private ClassTwo classTwo;

        private String description;

        @Length(max = 1000, message = "{classone.description.length}")
        @Pattern(regex = "([a-zA-Z0-9\\s]*)", message = "{classone.description.alpha}")
        public String getDescription() {
          return description;
        }

        public void setDescription(String description) {
          this.description= description;
        }

      }


      @Name("classTwo")
      @Scope(ScopeType.CONVERSATION)
      @Entity
      @AutoCreate
      @Table(name = "classTwo", schema = "demo")
      public class ClassTwo {

        private String data;

        @Length(max = 7, message = "{classTwo.data.length}")
        @Pattern(regex = "([a-zA-Z0-9\\s]*)", message = "{classTwo.data.alpha}")
        public String getData() {
          return data;
        }

        public void setData(String data) {
          this.data = data;
        }

      }


      The validation messages for the 'description' is displayed on the view but for 'data' it is not displayed.

      Couldn't found out what exactly the reason might be!

      Please help me to solve this issue!