[jboss-user] [JBoss Seam] - Validation patter -> Invalid State

enda do-not-reply at jboss.com
Sat Feb 9 02:37:28 EST 2008


Hey, I have a question about annotation @Pattern and seam validation of the annotated field. I have this annotation


  |   @NotNull
  |     @Pattern(regex="[a-zA-Z]?[a-zA-Z0-9]+", 
  |             message="Username must start with a letter, and only contain letters or numbers")
  |     public String getFirstName() {
  |         return firstName;
  |     }
  | 

When I call this from view form I will get:
 /*message*/	
Exception was thrown:validation failed for: edu.baylor.icpc.model.businessobjects.PersonInfo

and log:




  | 01:19:02,534 ERROR [ExceptionHandler] Exception[Ljava.lang.StackTraceElement;@875e63
  | 01:19:02,534 ERROR [ExceptionHandler] Exception
  | org.hibernate.validator.InvalidStateException: validation failed for: edu.xx.xx.model.businessobjects.PersonInfo
  |         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)
  | 
  |         ...
  | 
  | org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
  |         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
  |         at java.lang.Thread.run(Thread.java:619)
  | 01:19:02,537 WARN  [ReadWriteCache] An item was expired by the cache while it was locked (increase your cache timeout): edu.xx.xx.model.businessobjects.PersonInfo#2
  | 
  | 

Next valid attempt also fail:

        /*message*/
 	Exception was thrown:null 
 	Transaction failed



  | [AbstractFlushingEventListener] Could not synchronize database state with session
  | org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [edu.xx.xx.model.businessobjects.PersonInfo#2]
  | ...
  | Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [edu.baylor.icpc.model.businessobjects.PersonInfo#2]
  | 
  | 

I guess that here I am supposed to call entityManager.merge() to get valid object state?
But what about @Pattern validation. Is that expected behavior?

(When I use entityHome from seam-gened application it fails too)

Thanks Tomas

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128049#4128049

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128049



More information about the jboss-user mailing list