code: public boolean isUniqueConstraintError(SQLException e) {
          if (isConstraintError(e)) {
              String sqlstate = e.getSQLState();
              return SQLSTATE_UNIQUE_CONSTRAINT_VIOLATION.equals(sqlstate);
          }
          return false;
      }
docs: Examines the SQLSTATE code of the given SQL exception and determines if
  it is a unique constaint violation.