-->
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: GetPotentialInvalidValues and Nesting
PostPosted: Mon Feb 02, 2009 3:11 pm 
Newbie

Joined: Mon Feb 02, 2009 2:59 pm
Posts: 1
Hello all,

I'm working on a project with Hibernate Validator and form submissions. What I'm trying to do is set up a way to progressively validate each form field, where the fields represent properties on an entity, with the validator. My current attempts use the validator's getPotentialInvalidValues() method, but as the comments on the method say, it won't do nesting.

My current implementation passes the beanpath to the field being validated and the value in the input to a servlet where I have a ClassValidator for the type that the form represents. This works fine for simple properties like foo.emailAddress, but like I said before, something like foo.x.y.z fails entirely.

I can always do something like instantiate an object of type foo and validate the entire class, then prune out all the InvalidValues that I'm not currently concerned about, but this seems like a roundabout way to do it.

Another way would be to parse the beanpath myself and use reflection to get the types of each path so I can create the correct ClassValidator, in essence doing the nesting that getPotentialInvalidValues currently doesn't.

Does anybody have any advice regarding my plight?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2009 10:44 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I think the answer to your plights is Bean Validation (JSR 303). We are currently implementing a reference implementation of this spec and will shortly release an alpha version of this framework. In fact this implementation will replace the current Hibernate Validator. The Bean Validation specification will support recursive properties checking. See also - http://hibernate.org/459.html

In case you cannot wait I guess you could work with your proposed workaround or contribute a recursive implementation for the exiting Hibernate Validator code.

--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.