Class DBException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DBException

public class DBException extends AdempiereException
This RuntimeException is used to pass SQLException up the chain of calling methods to determine what to do where needed.
Version:
$Id: DBException.java,v 1.2 2006/07/30 00:54:35 jjanke Exp $
Author:
Vincent Harcq, Teo Sarca, SC ARHIPAC SERVICE SRL, Armen Rizal, GOODWILL CONSULTING FR [2789943] Better DBException handling for PostgreSQL https://sourceforge.net/p/adempiere/feature-requests/719/
See Also:
  • Field Details

  • Constructor Details

    • DBException

      public DBException(Exception e)
      Create a new DBException based on a SQLException
      Parameters:
      e - Specify the Exception cause
    • DBException

      public DBException(SQLException e, String sql)
      Create a new DBException based on a SQLException and SQL Query
      Parameters:
      e - exception
      sql - sql query
    • DBException

      public DBException(String msg)
      Create a new DBException
      Parameters:
      msg - Message
    • DBException

      public DBException(String msg, Exception e)
      Create a new DBException
      Parameters:
      msg - Message
      e - Exception
  • Method Details

    • getSQL

      public String getSQL()
      Returns:
      SQL Query or null
    • getSQLException

      public SQLException getSQLException()
      Returns:
      Wrapped SQLException or null
    • getErrorCode

      public int getErrorCode()
      See Also:
    • getNextException

      public SQLException getNextException()
      See Also:
    • getSQLState

      public String getSQLState()
      See Also:
    • isUniqueContraintError

      public static boolean isUniqueContraintError(Exception e)
      Check if Unique Constraint Exception (aka ORA-00001)
      Parameters:
      e - exception
      Returns:
      true if e is unique constraint exception
    • isChildRecordFoundError

      public static boolean isChildRecordFoundError(Exception e)
      Check if "child record found" exception (aka ORA-02292)
      Parameters:
      e - exception
      Returns:
      true if e is child record found exception (typically for delete)
    • isInvalidIdentifierError

      public static boolean isInvalidIdentifierError(Exception e)
      Check if "invalid identifier" exception (aka ORA-00904)
      Parameters:
      e - exception
      Returns:
      true if e is invalid identifier exception
    • isInvalidUserPassError

      public static boolean isInvalidUserPassError(Exception e)
      Check if "invalid username/password" exception (aka ORA-01017).
      Only implemented for Oracle.
      Parameters:
      e - exception
      Returns:
      true if e is invalid user/password exception
    • isTimeout

      public static boolean isTimeout(Exception e)
      Check if "time out" exception (aka ORA-01013)
      Parameters:
      e -
      Returns:
      true if e is time out exception
    • isValueTooLarge

      public static boolean isValueTooLarge(Exception e)
      Check if value too large for column exception (aka ORA-12899)
      Parameters:
      e - exception
      Returns:
      true if e is value too large for column exception
    • getDefaultDBExceptionMessage

      public static String getDefaultDBExceptionMessage(Exception e)
      Parameters:
      e -
      Returns:
      default AD message for exception or null