I’m using Hibernate Validator. I have a Class level annotation. It compares three properties for equality. When the validation is performed I need to get the PropertyPaths from the javax.validation.ConstraintViolation object returned. Since it’s not a single field the getPropertyPath() method returns null. Is there another way to find the PropertyPaths?
This is my annotation implementation –
@MatchField.List({
@MatchField(firstField = "firstAnswer", secondField = "secondAnswer", thirdField = "thirdAnswer"),
})
You need to set the messages to map to the properties that you want rejected when you do the validation. Hibernate Validator has no way to auto-magically figure out that custom annotation properties are property paths.