-->
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: Is there any way to specify custome validator for package?
PostPosted: Thu Feb 25, 2010 10:03 am 
Newbie

Joined: Fri Dec 28, 2007 12:27 pm
Posts: 2
We want specify custom valuator for ALL Date fields of ALL classes in predefined package (Dates of domain model are stored in DB and should fit in predefined range that is smaller than Date object supports). Is it possible to do this with Hibernate Validator 4?

Den


Top
 Profile  
 
 Post subject: Re: Is there any way to specify custome validator for package?
PostPosted: Thu Feb 25, 2010 11:24 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
No that's not possible in Bean Validation (which is the specification Hibernate Validator is the reference implementation for). You have to explicitly specify all constraints, either via annotations or via xml configuration.
I guess you could write a custom class validator which checks for date instances in the class (via reflection) and validates them. Note, I don't recommend this!

What you are asking for is some sort of aspect type of language to apply constraints. I personally think this could get quite ugly, but you could suggest this feature on the BVAL forum or jira.

--Hardy


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.