Class DatabaseConstraintViolationException

  • All Implemented Interfaces:
    java.io.Serializable

    public class DatabaseConstraintViolationException
    extends java.lang.RuntimeException
    A database exception that represents a constraint violation.
    Author:
    Tobias Downer
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CHECK_VIOLATION
      A Check constraint violation error code.
      static int DROP_COLUMN_VIOLATION
      Column can't be dropped before of an reference to it.
      static int DROP_TABLE_VIOLATION
      Tried to drop a table that is referenced by another source.
      static int FOREIGN_KEY_VIOLATION
      A Foreign Key constraint violation error code.
      static int JAVA_TYPE_VIOLATION
      Java type constraint violation error code (tried to insert a Java object that wasn't derived from the java object type defined for the column).
      static int NULLABLE_VIOLATION
      A Nullable constraint violation error code (data added to not null columns that was null).
      static int PRIMARY_KEY_VIOLATION
      A Primary Key constraint violation error code.
      static int UNIQUE_VIOLATION
      A Unique constraint violation error code.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getErrorCode()
      Returns the violation error code.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • PRIMARY_KEY_VIOLATION

        public static final int PRIMARY_KEY_VIOLATION
        A Primary Key constraint violation error code.
        See Also:
        Constant Field Values
      • UNIQUE_VIOLATION

        public static final int UNIQUE_VIOLATION
        A Unique constraint violation error code.
        See Also:
        Constant Field Values
      • CHECK_VIOLATION

        public static final int CHECK_VIOLATION
        A Check constraint violation error code.
        See Also:
        Constant Field Values
      • FOREIGN_KEY_VIOLATION

        public static final int FOREIGN_KEY_VIOLATION
        A Foreign Key constraint violation error code.
        See Also:
        Constant Field Values
      • NULLABLE_VIOLATION

        public static final int NULLABLE_VIOLATION
        A Nullable constraint violation error code (data added to not null columns that was null).
        See Also:
        Constant Field Values
      • JAVA_TYPE_VIOLATION

        public static final int JAVA_TYPE_VIOLATION
        Java type constraint violation error code (tried to insert a Java object that wasn't derived from the java object type defined for the column).
        See Also:
        Constant Field Values
      • DROP_TABLE_VIOLATION

        public static final int DROP_TABLE_VIOLATION
        Tried to drop a table that is referenced by another source.
        See Also:
        Constant Field Values
      • DROP_COLUMN_VIOLATION

        public static final int DROP_COLUMN_VIOLATION
        Column can't be dropped before of an reference to it.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DatabaseConstraintViolationException

        public DatabaseConstraintViolationException​(int err_code,
                                                    java.lang.String msg)
        Constructor.
    • Method Detail

      • getErrorCode

        public int getErrorCode()
        Returns the violation error code.