-->
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: initialize ConstraintValidator using a query
PostPosted: Tue Jun 21, 2011 12:59 pm 
Newbie

Joined: Mon May 18, 2009 12:00 pm
Posts: 17
I have an entity called Audit this has a property auditnumber , I get these entities froma a csv file, I parse this file and create collection of audts. If any audit has auditnumber which is already in database then its invalid audit , for checking this I want to use Hibernate custom validator ,
this custom validator I want to initialize with a collection of auditnumbers which are already in database and in isValid method I will check if this number exists I return false,
can I do this , I mean I did not see any example of ConstraintValidator which I initialize using a query or someother bean , please advice me how to achieve this.


Top
 Profile  
 
 Post subject: Re: initialize ConstraintValidator using a query
PostPosted: Wed Jun 22, 2011 4:21 am 
Contributor
Contributor

Joined: Mon Feb 28, 2011 7:27 pm
Posts: 20
Location: France
Hi,

I think the following article could help you http://community.jboss.org/wiki/Accessi ... tValidator
Be careful this approach has cons as discussed in the post.

Hope this help

--Kevin


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.