| Author |
validate two propertis with only one custom validator
|
gianluca gian
Greenhorn
Joined: Aug 14, 2009
Posts: 27
|
|
hello, I have a problem with validation. Is it possible to validate two properties of a bean using only one ConstraintValidator? I have something like the following:
inside the CheckSomeBeanPropertiesValidator I call the service SomeApplicationService that returns some data searched calling findBySearchBean. Instead to have to call more than one customized ConstraintValidator (and more than one findBySearchBean) is it possible to call only one time the service and check two different properties?
Thanks
bye
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
Please UseCodeTags when posting code it makes it easier to read. I have added them for you so you can see the difference it makes.
It looks like your question is how to create an annotation that allows you to validate multiple fields. There is a good explanation of that here:
http://stackoverflow.com/questions/1972933/cross-field-validation-with-hibernate-validator-jsr-303
|
[How To Ask Questions][Read before you PM me]
|
 |
gianluca gian
Greenhorn
Joined: Aug 14, 2009
Posts: 27
|
|
|
Yes in that way source code is much better. I will read what you suggested me soon, I think it's right what I was looking for. Thank you. Bye
|
 |
 |
|
|
subject: validate two propertis with only one custom validator
|
|
|