0 Replies Latest reply on May 4, 2010 7:28 AM by Joshua D

    validation constraints not enforced on update

    Joshua D Novice

      The pattern, length validation of my loginid field is properly done during 'persist', but fails with the following error if I modify just the loginid element. What am I missing here?


      @Column(name = "loginid", unique = true, length = 75, nullable = false)
      @UserPrincipal
      @NotBlank
      @Pattern(regex = "^[A-Za-z0-9]*$", message = "{validator.alphanumeric.only}")
      @Length(min = 4, message = "{validator.loginid.length}")
      private String loginId;
      
      Caused by: javax.faces.el.EvaluationException: org.hibernate.validator.InvalidSt
      ateException: validation failed for: com.mycompany.model.User
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(Met
      hodBindingMethodExpressionAdapter.java:102)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionList
      enerImpl.java:102)
      ... 52 more
      Caused by: org.hibernate.validator.InvalidStateException: validation failed for:
      com.mycompany.model.User
      at org.hibernate.validator.event.ValidateEventListener.validate(Validate
      EventListener.java:148)
      at org.hibernate.validator.event.ValidateEventListener.onPreUpdate(Valid
      ateEventListener.java:177)
      at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.
      java:237)
      at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.ja
      va:88)