Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Cross-Property validation
PostPosted: Thu Jan 21, 2010 5:28 am 
Newbie

Joined: Thu Jan 21, 2010 5:18 am
Posts: 3
Hi,

is it possible to implement an "Equals" annotation like in ExtVal or do CrossValidation in another way?

Im using HibernateValidator 4.0.2GA and JSF RI 2.0.1.

Thanks and best regards


Top
 Profile  
 
 Post subject: Re: Cross-Property validation
PostPosted: Thu Jan 21, 2010 7:48 pm 
Newbie

Joined: Thu Jan 21, 2010 5:18 am
Posts: 3
Today i also checked the source of the bean validation api and the simplest way is to add the current validated bean to the isValid method in the ConstraintValidator.
So an @Equals annotation would be possible.
Why isn't this implemented ?
Any ideas ?


Top
 Profile  
 
 Post subject: Re: Cross-Property validation
PostPosted: Fri Feb 05, 2010 8:13 pm 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 176
Hi,

cross-validation can be done by implementing a class level constraint: http://docs.jboss.org/hibernate/stable/ ... le/#d0e328

Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: Cross-Property validation
PostPosted: Sat Feb 06, 2010 4:54 pm 
Newbie

Joined: Thu Jan 21, 2010 5:18 am
Posts: 3
Hi,

AFAIK its actually not possible to use class-level-constraints in JSF.
And why i should use class-level constraints?
if you have an "password" field and an "repeat password" field and you want to cross validate this fields, it should be possible to say that the message should appear on one of those fields (an not for example in the whole web-form). The only way to implement this would be to add the bean to the constraint-validator (so an Equals-annotation would be possible).

Zoigl


Top
 Profile  
 
 Post subject: Re: Cross-Property validation
PostPosted: Sun Feb 07, 2010 4:03 am 
Newbie

Joined: Sun Feb 07, 2010 3:23 am
Posts: 1
Location: usa
I agree this forum.......if you have an "password" field and an "repeat password" field and you want to cross validate this fields, it should be possible to say that the message should appear on one of those fields (an not for example in the whole web-form). The only way to implement this would be to add the bean to the constraint-validator (so an Equals-annotation would be possible).

_________________
Advanced Acai
Super White Teeth


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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.