-
1. Re: [Help] Bean Validation
hardy.ferentschik Jun 20, 2012 10:07 AM (in response to grubi)Have you tried placing @Valid onto field or getter of MyObj?
-
2. Re: [Help] Bean Validation
grubi Jun 20, 2012 10:52 AM (in response to hardy.ferentschik)I already tried @Valid.
Edit:
I did some debugging and found the root cause of the problem. In my real application my field is a private one and starts with an underscore. I put the annotation on this field directly. But my getter was named without this underscore (_text vs. getText()) and the validator implementation performs an equals() on those two names (getText() will be used as text). So _text != text and no validation will be performed... Good to know but in the end it's a logic process. How should the implementation know that getText() is returning _text.^^
So at all others that stumble over this thread looking for an answer: Always annotate the getters or name the annotated variables the same as the getters
Now all I have to do is to find out, why I don't get the error message. But that might be a wrong config. Thanks anyway Hardy
-
3. Re: [Help] Bean Validation
hardy.ferentschik Jun 22, 2012 6:54 AM (in response to grubi)Glad you found the answer :-)