DATAREST-798 - Fixed invalid implementation of ValidationErrors.

Changed the implementation of ValidationErrors to be based on AbstractBeanPropertyBindingResult to consider the nesting implemented in superclasses and using a PersistentPropertyAccessor to lookup the property values.

ValidatingRepositoryEventListener now uses this implementation if a PersistentEntity can be obtained for the type under consideration, falling back to a DirectFieldBindingResult otherwise.
This commit is contained in:
Oliver Gierke
2016-04-04 15:12:21 +02:00
parent 9e58ab92c5
commit b530cbe471
5 changed files with 143 additions and 65 deletions

View File

@@ -39,8 +39,8 @@ public class RepositoryConstraintViolationExceptionMessage {
String message = accessor.getMessage(fieldError);
this.errors.add(new ValidationError(fieldError.getObjectName(), message, String.format("%s",
fieldError.getRejectedValue()), fieldError.getField()));
this.errors.add(new ValidationError(fieldError.getObjectName(), message,
String.format("%s", fieldError.getRejectedValue()), fieldError.getField()));
}
}