java.lang.Object
java.lang.Throwable
java.lang.Exception
java.sql.SQLException
java.sql.SQLNonTransientException
java.sql.SQLIntegrityConstraintViolationException
- 所有已实现的接口:
-
Serializable,Iterable<Throwable>
当 SQLState 类值为 '23' 时,或在供应商指定的条件下抛出的
SQLException 的子类。这表示违反了完整性约束(外键、主键或唯一键)。
请查阅您的驱动程序供应商文档,了解可能引发此 Exception 的供应商指定条件。
- 自从:
- 1.6
- 参见:
-
Constructor Summary
ConstructorsConstructorDescription构造一个SQLIntegrityConstraintViolationException对象。构造一个带有给定reason的SQLIntegrityConstraintViolationException。SQLIntegrityConstraintViolationException(String reason, String SQLState) 构造一个带有给定reason和SQLState的SQLIntegrityConstraintViolationException对象。SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode) 构造一个带有给定reason、SQLState和vendorCode的SQLIntegrityConstraintViolationException对象。SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode, Throwable cause) 构造一个带有给定reason、SQLState、vendorCode和cause的SQLIntegrityConstraintViolationException对象。SQLIntegrityConstraintViolationException(String reason, String SQLState, Throwable cause) 构造一个带有给定reason、SQLState和cause的SQLIntegrityConstraintViolationException对象。SQLIntegrityConstraintViolationException(String reason, Throwable cause) 构造一个带有给定reason和cause的SQLIntegrityConstraintViolationException对象。构造一个带有给定cause的SQLIntegrityConstraintViolationException对象。 -
Method Summary
Methods declared in class java.sql.SQLException
getErrorCode, getNextException, getSQLState, iterator, setNextExceptionMethods declared in class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods declared in interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException()构造一个SQLIntegrityConstraintViolationException对象。reason、SQLState被初始化为null,供应商代码初始化为 0。cause未初始化,可以随后通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化。- 自从:
- 1.6
-
SQLIntegrityConstraintViolationException
构造一个带有给定reason的SQLIntegrityConstraintViolationException。SQLState被初始化为null,供应商代码初始化为 0。cause未初始化,可以随后通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化。- 参数:
-
reason- 异常的描述 - 自从:
- 1.6
-
SQLIntegrityConstraintViolationException
构造一个带有给定reason和SQLState的SQLIntegrityConstraintViolationException对象。cause未初始化,可以随后通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化。 供应商代码初始化为 0。- 参数:
-
reason- 异常的描述 -
SQLState- 用于标识异常的 XOPEN 或 SQL:2003 代码 - 自从:
- 1.6
-
SQLIntegrityConstraintViolationException
构造一个带有给定reason、SQLState和vendorCode的SQLIntegrityConstraintViolationException对象。cause未初始化,可以随后通过调用Throwable.initCause(java.lang.Throwable)方法进行初始化。- 参数:
-
reason- 异常的描述 -
SQLState- 用于标识异常的 XOPEN 或 SQL:2003 代码 -
vendorCode- 数据库供应商特定的异常代码 - 自从:
- 1.6
-
SQLIntegrityConstraintViolationException
构造一个带有给定cause的SQLIntegrityConstraintViolationException对象。SQLState被初始化为null,供应商代码初始化为 0。 如果cause==null,则reason被初始化为null,如果cause!=null,则reason被初始化为cause.toString()。- 参数:
-
cause- 此SQLException的根本原因(保存以供稍后通过getCause()方法检索);可能为 null,表示原因不存在或未知。 - 自从:
- 1.6
-
SQLIntegrityConstraintViolationException
构造一个带有给定reason和cause的SQLIntegrityConstraintViolationException对象。SQLState被初始化为null,供应商代码初始化为 0。- 参数:
-
reason- 异常的描述。 -
cause- (保存以供稍后通过getCause()方法检索);可能为 null,表示原因不存在或未知。 - 自从:
- 1.6
-
SQLIntegrityConstraintViolationException
构造一个带有给定reason、SQLState和cause的SQLIntegrityConstraintViolationException对象。 供应商代码初始化为 0。- 参数:
-
reason- 异常的描述。 -
SQLState- 用于标识异常的 XOPEN 或 SQL:2003 代码 -
cause- 此SQLException的根本原因(保存以供稍后通过getCause()方法检索);可能为 null,表示原因不存在或未知。 - 自从:
- 1.6
-
SQLIntegrityConstraintViolationException
public SQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode, Throwable cause) 构造一个带有给定reason、SQLState、vendorCode和cause的SQLIntegrityConstraintViolationException对象。- 参数:
-
reason- 异常的描述 -
SQLState- 用于标识异常的 XOPEN 或 SQL:2003 代码 -
vendorCode- 数据库供应商特定的异常代码 -
cause- (保存以供稍后通过getCause()方法检索);可能为 null,表示原因不存在或未知。 - 自从:
- 1.6
-