Package org.hibernate.exception
Class ConstraintViolationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
jakarta.persistence.PersistenceException
org.hibernate.HibernateException
org.hibernate.JDBCException
org.hibernate.exception.ConstraintViolationException
- All Implemented Interfaces:
Serializable
A
JDBCException
indicating that the requested DML operation
resulted in violation of a defined integrity constraint.- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionConstraintViolationException
(String message, SQLException root, @Nullable String constraintName) ConstraintViolationException
(String message, SQLException root, String sql, @Nullable String constraintName) ConstraintViolationException
(String message, SQLException root, String sql, ConstraintViolationException.ConstraintKind kind, @Nullable String constraintName) ConstraintViolationException
(String message, SQLException root, ConstraintViolationException.ConstraintKind kind, @Nullable String constraintName) -
Method Summary
Methods inherited from class org.hibernate.JDBCException
getErrorCode, getErrorMessage, getSQL, getSQLException, getSQLState
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ConstraintViolationException
public ConstraintViolationException(String message, SQLException root, @Nullable String constraintName) -
ConstraintViolationException
public ConstraintViolationException(String message, SQLException root, String sql, @Nullable String constraintName) -
ConstraintViolationException
public ConstraintViolationException(String message, SQLException root, ConstraintViolationException.ConstraintKind kind, @Nullable String constraintName) -
ConstraintViolationException
public ConstraintViolationException(String message, SQLException root, String sql, ConstraintViolationException.ConstraintKind kind, @Nullable String constraintName)
-
-
Method Details
-
getConstraintName
Returns the name of the violated constraint, if known.- Returns:
- The name of the violated constraint, or null if not known.
-
getKind
Returns the kind of constraint that was violated.
-