src/dao/Util.java
/*
     * Finds all the constraint violation messages in an exception, and
     * concatenates them into a single error message.
     */
Finds all the constraint violation messages in an exception, and
concatenates them into a single error message.
Finds all the constraint violation messages in an exception and concatenates them into a single error message .
public static String buildErrorMessage(ConstraintViolationException ex) {
        StringBuilder message = new StringBuilder();
        for (ConstraintViolation violation : ex.getConstraintViolations()) {
            if (message.length() != 0) {
                message.append(", ");
            }
            message.append(violation.getMessage());
        }
        message.append(".");
        return message.toString();
    }
public static String buildErrorMessage ( ConstraintViolationException ex ) { StringBuilder message = new StringBuilder ( ) ; for ( ConstraintViolation violation : ex . getConstraintViolations ( ) ) { if ( message . length ( ) != 0 ) { message . append ( ", " ) ; } message . append ( violation . getMessage ( ) ) ; } message . append ( "." ) ; return message . toString ( ) ; }
Finds all the constraint violation messages in an exception, and
 concatenates them into a single error message.
Finds all the constraint violation messages in an exception and concatenates them into a single error message .