The hibernate-all.jar that we provide containing hibernate is actually quite old. The api for validator has changed between it and the version in JBossAS 4.2.1. So, replace hibernate-all.jar with the jars from hibernate/lib (in the seam distro).
Thanks for your reply, Pete. I forgot to mention that I'm using the CVS based Seam 2. When building the Seam example such as the hotel booking example, by default no Hibernate jars are packaged. Rather, the Hibernate jars shipped with JBoss AS are used (I'm using JBoss 4.2.1GA).
I looked at the hibernate/lib directory of the CVS based Seam:
It includes Hibernate 3.2.1.ga, Hibernate Annotations 3.2.1.GA and Hibernate EntityManager Version: 3.2.1.GA.
Thus, only the Hibernate version is more recent than the one shipped with JBoss 4.2.1GA, but the Hibernate Annotations and Hibernate EntityManager are the same as shipped with JBoss 4.2.1GA. While there are more recent versions available (Hibernate EntityManager 3.3.1GA and Hibernate Annotations 3.3.0GA, with Hibernate validator now separate in Hibernate validador 3.3.0GA.jar), these are not included in the Seam based CVS.
I also forgot to mention that only the @Min Hibernate validator failed. The @NotNull validator and other validators such as @Length are working fine.
Sure, no hibernate stuff from Seam is packaged in as runtime dependencies, but, for the examples at least, the hibernate-all.jar *is* used to compile the example (and hence the @Min annotation). The api for @Min has changed between the version of hibernate-all (not sure what this is btw) we have and the hibernate in the AS. I was able to fix it by removing hibernate-all.jar and adding the hibernate/lib to the compile classpath.
What he said. Our project just hit a different bug with the validators in JBoss 4.2.1 that has been fixed in validators-3.3.0 (@Email does not tolerate null values as happens with empty JSF text fields -- http://opensource.atlassian.com/projects/hibernate/browse/HV-3).
Clear instructions for how to update to a fixed version would be very helpful!
The following is not a Seam issue, even though it may be important to Seam users.
What needs to be done in order to successfully use the org.hibernate.validator.Min validator? Could a solution be the replacement of the Hibernate packages shipped with JBoss AS 4.2.1GA with more recent versions? I tried to replace those Hibernate jars with Hibernate core 3.3.0GA, Hibernate EntityManager 3.3.1.GA, Hibernate Annotations 3.3.0GA and Hibernate Validator 3.0.0GA, but this produces a a classloading error when Hibernate is started up.
Are there any instructions out there how JBossAS needs to be configured when using the latest Hibernate versions?
I've managed to get a working @Email validator by replacing all the hiberate*.jar files in my JBOSS/server/default/lib directory with the following:
hibernate-annotations.jar (from hibernate-annoations-3.3.0.GA) hibernate-commons-annotations.jar (ditto) hibernate-entitymanager.jar (from hibernate-entitymanager-3.3.1.GA) ejb3-persistance.jar (from hibernate-entitymanager-3.3.1.GA) hibernate-validator.jar (from hibernate-validator-3.0.0.GA) hibernate3.jar (from hibernate-3.2.5.ga)
I've replaced the lib/hibernate-all.jar bundled with Seam with the above for compile-time and all seems to work OK so far.
I've not tested the @Min validator that originally started this thread.
Does anyone know if this problem still exists in Seam 2.0?
We now have a current version of Hibernate in 2.0.1