-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: ConstraintViolationException issuse with Hibernate JPA
PostPosted: Fri Oct 22, 2010 3:03 am 
Newbie

Joined: Fri Jun 04, 2010 8:57 pm
Posts: 19
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


Top
 Profile  
 
 Post subject: Re: ConstraintViolationException issuse with Hibernate JPA
PostPosted: Tue Oct 26, 2010 9:15 pm 
Newbie

Joined: Fri Jun 04, 2010 8:57 pm
Posts: 19
Well I am pretty much confused with the exception thrown by Hibernate. I was expecting javax.validation.... exceptions (for Hibernate-JPA), but hibernate throws org.hibernate...... exceptions. Do I have to sacrifice portability of JPA just for the sake of handling exceptions. Or am I missing some configuration information. I have been down with this problem for a week now and still not able to solve it.

regards,
Nirvan.


Top
 Profile  
 
 Post subject: Re: ConstraintViolationException issuse with Hibernate JPA
PostPosted: Fri Jan 21, 2011 2:04 am 
Newbie

Joined: Fri Jan 21, 2011 1:59 am
Posts: 1
Hi Nirvan,

Did you end up finding a solution to this problem?

Stephen


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.