mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-22 19:15:15 +00:00
HHH-5724 display the constraint failures on Bean Validation exception
This commit is contained in:
parent
4d31c6b88e
commit
42261a61df
@ -146,12 +146,18 @@ private <T> void validate(T object, EntityMode mode, EntityPersister persister,
|
||||
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
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user