0 Replies Latest reply on Jul 2, 2007 10:12 AM by Mahesh Shinde

    @Pattern doesn't accept null.

    Mahesh Shinde Newbie

      Hi,

      In my application I am using @Pattern annotation. It is working fine but If I am keep that property value as null, then I am getting Hibernate Validator Failed exception.

      And One more thing 'email1' property is nullable.

      @Pattern(regex = ".+@.+\\.[a-z]+")
      private String email1;
      


      Exception :
      Caused by: org.hibernate.validator.InvalidStateException: validation failed for: de.bonprix.orderstarter.model.entity.Supplier
       at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:143)
       at org.hibernate.validator.event.ValidateEventListener.onPreUpdate(ValidateEventListener.java:172)
       at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:217)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:65)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
       at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:515)
       ... 84 more


      Temporarily I resolved this problem by writting Own Email Validator.

      So I thing this might be bug.