Another Gotcha.... if you have a
| @Length(min = 12, max = 30, message = "sim must between 12 and 30 characters long") | on a Database Object that is NOT mandatory (like a post code) that is mapped to a view component of type string. If you leave the string empty in the view you get a "" back as apposed to a null (which seems helpful as it reduces a lot of null pointer exceptions). However, I had to write code to convert the "" back to null just before persisting it to stop the validator failing... | // Need to set "" to null for validator to allow a blank field through. | subscriber.setCreationDate(new Date()); | if (subscriber.getXxx().equals("")) { | ZZZZZZZ.setXxx(null); | } | if (subscriber.getYyy().equals("")) { | ZZZZZZZ.setYyy(null); | } | em.persist(ZZZZZZ); | I could have extended the validator, but this seemed wrong as a string of "" should fail !!! The better solution was to pass null to the validator. humm... View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3985975#3985975 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3985975 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user