I'm using Jersey 2.22 and Hibernate 4.1.4.
According to the Jersey documentation:
Quote:
Bean Validation support in Jersey is provided as an **extension module** and needs to be mentioned explicitly in your pom.xml file (in case of using Maven)
As far as I can understand, it's not required. However, I'm using Hibernate as well in my project and this may be a huge factor.
Funny thing is that I don't use bean validation in my Hibernate, everything's old school configured in XML (mapping, persistence, session factory, etc). When I use my Hibernate project alone with Struts2 or plain Servlet projects, it works perfectly.
This error comes up
Code:
org.hibernate.HibernateException: Error applying BeanValidation relational constraints
whenever I include the
Code:
validation-api-1.1.0-Final.jar
, which came from the Jersey bundle, as part of my dependencies.
The temporary fix I made is to disable
Code:
javax.persistence.validation.mode
in my Hibernate configuration and everything worked out alright. But the problem is, I don't want to touch my configuration anymore since this Hibernate project is used across all my projects and I fear that this small change might make a huge impact - paranoia I guess.
So I have two questions:
1. Why is Jersey requiring me to include a bean validation dependency? (requiring in the sense that if I don't have one, my app will keep throwing an exception)
2. Seeing that I don't use bean validations for Hibernate but intend to use bean validations in Jersey, am I better off disabling
Code:
javax.persistence.validation.mode
? or will it be best to just include a bean validation jar?