Quote:
I'm using Hibernate Validator (Version 3+),
What exactly is 3+. Are you using 3.1.0 GA or a 4.0.0 Alpha/Beta version? There is a uge difference. Pre version 4.x Hibernate Validator was based on a different codebase. The 4.x version is now an implementation of the JSR 303 - Bean Validation.
Quote:
I was hoping to use an Annotation such as "Unique" on an Entity to signal to the Hibernate Validator that it should report an error if I have two beans with the exact same value in the "Unique" field.
Neither the the legacy (pre 4.x) nor the Bean Validation based Validator framework has a built-in annotation for that. However, either in both cases it would be quite easy to write a custom validator.
Quote:
This doesn't seem to work. Another feature that I had hoped would be in Hibernate Validator is the ability to get error messages about ConstraintViolationException(s) from Hibernate. In other words - I still need to write code to check that the Entity that I am acting upon (either updating or deleting, etc) does not violate any constraints that I have set out using Hibernate Annotations.
The next version of Hibernate (or better annotations) will automatically register the new Validator framework if it is on the classpath. For now you would have to write your own event listener. You can have a look at this code to see how it is done -
http://fisheye.jboss.org/browse/Hiberna ... va?r=16516Hope this helps.
--Hardy