I am trying to configure javax.validation framework using hibernate-validator-4.1.0. I am trying to catch "javax.validation.ConstraintViolationException", but the validator framework throws "org.hibernate.exception.ConstraintViolationException" instead. Here is my configuration file.
persistence.xml.
Code:
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="ArpanJyotiDonorPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/DonorDB</jta-data-source>
<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
<mapping-file>orm.xml</mapping-file>
<validation-mode>CALLBACK</validation-mode>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
Why is the validation framework not throwing "javax.validation.ConstraintViolationException" for constraint violations.
regards,
Nirvan