Reputation: 786
Having the standardized Validator from the javax package created like in the manual
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
it won't recognize old validator annotations from the org.hibernate.validator package, is there any option to get them work with the hibernate 4 validator without refactoring the whole project?
We used hibernate 3 until we decided to migrate our project to hibernate 4. While using the org.hibernate.validator.ClassValidator for the moment, it is not possible to use this class with hibernate 4 validator due to standardization.
So does someone have any possible solution how to stick with the old validator annotations, but still get classes validated within the project scope without refactoring and modifying the whole sourcecode? Any help appreciated.
Upvotes: 1
Views: 417
Reputation: 19109
There is no way to do this. You will have to migrate your annotations/constraints. The Hibernate Validator 3 code base is obsolete and no further development occurs on this version of Validator.
Hibernate Validator 4.x (and later) release does not recognize Validator 3 annotations as Bean Validation constraints. These constraints do not contain the required constraint marker annotation.
Migrating the annotation should really not be a big problem. In most cases you should be able to just change the package.
Upvotes: 2