hardy.ferentschik wrote:
The Bean Validation spec does separate the type in the ConstraintViolation. For implementation purposes we need however the type. I would normally not recommend to place constraint annotations on field and property. A consistent constraint placement is recommended. I assume that in your case the field and property return different values. I would be very careful with that.
All this said, one way to potentially solve your problems is to use the Payload functionality. Define a payload for the constraints you place on the field level and one for the ones you place on the property level. Payloads are passed through the system unmodified. You get access to the payload via the ConstraintDescriptor contained in the ConstraintViolation.
--Hardy
Hi,
I need to validate two field together. From your explanations and other posts, I have to use type constraints or property constraints. But after validating my domain entity, I have a ConstraintViolation set in which I have no idea which exception is coming from where.
Thanks