-->
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.  [ 2 posts ] 
Author Message
 Post subject: Validator not triggered on a persist()
PostPosted: Thu Sep 16, 2010 5:22 pm 
Newbie

Joined: Thu Sep 16, 2010 4:46 pm
Posts: 2
I am using Hibernate JPA 2 (hibernate-entitymanager-3.5.5) and hibernate-validator-4.1.0 with constraint annotations and I am able to get a set of ConstraintViolation objects on an @Entity when I use the Validator.validate() but when I persist() the same entity no ConstraintViolationException is thrown.

I have specified the following in persistence.xml:

Code:
      <properties>
         <property name="javax.persistence.validation.mode" value="callback, ddl" />
      </properties>


My understanding was that the validation listener on entity management with such a configuration is automatic but maybe I am missing something.

I also use Spring 3 and Java 5.

Regards,

Laurent


Top
 Profile  
 
 Post subject: Re: Validator not triggered on a persist()
PostPosted: Thu Sep 16, 2010 6:00 pm 
Newbie

Joined: Thu Sep 16, 2010 4:46 pm
Posts: 2
Sorry folks don't burn gas on this one. I spent half a day trying to get this to work and just when I was about to give up, things started to fall into place. Not sure what fixed things but I recompiled a dependency and cleaned up the classpath and now I get the expected behavior.

A bit frustrating but I am glad that things actually work as documented after all.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.