Yes, MySQLalways forget and catch SQLExceptionin the execution method. you need to catch SQLExceptionin your execution method, they throw a new oneMySQLIntegrityConstraintViolationException
public void executeQuery() {
try {
rs = pstmt.executeQuery();
} catch (SQLException ex) {
throw new MySQLIntegrityConstraintViolationException(ex);
}
therefore, in an external method called the execute method, it should only catch MySQLIntegrityConstraintViolationException
catch (MySQLIntegrityConstraintViolationException ex) {
}
Salah source
share