Java SQLException isPSQLUniqueViolation(SQLException ex)

Here you can find the source of isPSQLUniqueViolation(SQLException ex)

Description

Is the specified exception a PostgreSQL unique violation.

License

Apache License

Declaration

public static boolean isPSQLUniqueViolation(SQLException ex) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.SQLException;

import java.util.Objects;

public class Main {
    /**/*from w w w.  ja  va2  s. co  m*/
     * Is the specified exception a PostgreSQL unique violation.
     */
    public static boolean isPSQLUniqueViolation(SQLException ex) {
        return "23505".equals(Objects.requireNonNull(ex).getSQLState());
    }
}

Related

  1. isConstraintViolation(SQLException e)
  2. isDatabaseAlreadyExistsException(Exception e)
  3. isDataConversionException(SQLException se)
  4. isDuplicateKeyException(Exception ex)
  5. isInvalidParameterException(SQLException se)
  6. isReadOnlyException(SQLException e)
  7. isRecoverableException(SQLException e)
  8. isTransient(SQLException e)
  9. isXJ015Error(Throwable exception)