HHH-5724 display the constraint failures on Bean Validation exception

This commit is contained in:
Emmanuel Bernard 2010-11-10 12:23:38 +01:00
parent 4d31c6b88e
commit 42261a61df
1 changed files with 7 additions and 1 deletions

View File

@ -146,12 +146,18 @@ public class BeanValidationEventListener implements
classNames.add( violation.getLeafBean().getClass().getName() );
}
StringBuilder builder = new StringBuilder();
builder.append( "validation failed for classes " );
builder.append( "Validation failed for classes " );
builder.append( classNames );
builder.append( " during " );
builder.append( operation.getName() );
builder.append( " time for groups " );
builder.append( toString( groups ) );
builder.append( "\nList of constraint violations:[\n" );
for (ConstraintViolation<?> violation : constraintViolations) {
builder.append( "\t" ).append( violation.toString() ).append("\n");
}
builder.append( "]" );
throw new ConstraintViolationException(
builder.toString(), propagatedViolations
);