Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Call class level constraint from JSF 2
PostPosted: Sun May 01, 2011 9:00 pm 
Newbie

Joined: Sun May 01, 2011 8:51 pm
Posts: 2
I need cross field validation so I've created a class level constraint that requires one Date to be later than another date. This constraint does not get called from the JSF validation phase but only by the JPA layer when the object is saved to the database.

How do I get the class level constraint to be called during the JSF validation phase? I'm using JBoss 6.

Thanks.
Brian


Top
 Profile  
 
 Post subject: Re: Call class level constraint from JSF 2
PostPosted: Sat May 28, 2011 9:56 am 
Hibernate Team
Hibernate Team

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

this is not possible with JSF 2 atm. JSF only validates field level constraints by invoking Validator#validateValue() before the values are actually written into the model. So basically you have to perform the validation of class level constraints manually after the model update in this case.

This issue is planned to be addressed in a future version of Bean Validation, you might be interested in tracking BVAL-214 which deals with this problem.

Gunnar

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


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