0 Replies Latest reply on Sep 5, 2007 5:57 AM by andreigh.ts

    Problem using parameters for custom hibernate messages

    andreigh.ts

      I have an entoty bean with a property that has a max 255 length. I want to customize the default hibernate validator.length message, in order to display only the max value, not the min value (default validator.length is defined as 'length must be between {min} and {max}').

      So I have this code:

      @Length(max=255, message="#{messages['validator.length.maxonly']}")
      @Column(name = "Description", unique = false, nullable = false, insertable = true, updatable = true)
      public String getDescription() {
       return this.description;
      }
      


      in messages_en.properties, the key is defined like this

      validator.length.maxonly=length must be less or equal than {max}

      The problem is that {max} is not replaced at runtime with 255.