-->
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.  [ 4 posts ] 
Author Message
 Post subject: @EntityListeners(JPAValidateListener.class) doesn't validate
PostPosted: Wed Aug 12, 2009 7:55 am 
Regular
Regular

Joined: Tue Feb 17, 2009 5:13 am
Posts: 59
I have been trying the Java Persistence event-based validation:

  • setting hibernate.validator.autoregister_listeners to false
  • annotating my entity with @EntityListeners(JPAValidateListener.class)
  • annotating the fields with validation restrictions

Simply it does not works. I mean, it does not validate my entity...
Have I forgotten any step?
Anybody has achieved to do it work fine?
Please, help. I'm lost!

Thanks.

_________________
Born to lose... live to win!


Top
 Profile  
 
 Post subject: Re: @EntityListeners(JPAValidateListener.class) doesn't validate
PostPosted: Mon Aug 17, 2009 5:25 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
How does your save/update code look like? Are you actually using the entity manager API or are you using the plain Hibernate Session API? If you are using the entity manager API it should work just fine.

Have a look at this test case from the Hibernate Validator code base: JPAValidateListenerTest

--Hardy


Top
 Profile  
 
 Post subject: Re: @EntityListeners(JPAValidateListener.class) doesn't validate
PostPosted: Tue Aug 18, 2009 7:52 am 
Regular
Regular

Joined: Tue Feb 17, 2009 5:13 am
Posts: 59
I'm using the Hibernate API to manage the session.

It's possible to use JPA validation over Hibernate session API?

_________________
Born to lose... live to win!


Top
 Profile  
 
 Post subject: Re: @EntityListeners(JPAValidateListener.class) doesn't validate
PostPosted: Tue Aug 18, 2009 11:30 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
I guess, that's explains it. The JPAValidateListener only works with the JPA approach. Sorry :(


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