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
public class ConstraintViolationException extends JDBCException
AJDBCException
indicating that the requested DML operation resulted in violation of a defined integrity constraint.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConstraintViolationException(String message, SQLException root, @Nullable String constraintName)
ConstraintViolationException(String message, SQLException root, String sql, @Nullable String constraintName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable String
getConstraintName()
Returns the name of the violated constraint, if known.-
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 Detail
-
ConstraintViolationException
public ConstraintViolationException(String message, SQLException root, @Nullable String constraintName)
-
ConstraintViolationException
public ConstraintViolationException(String message, SQLException root, String sql, @Nullable String constraintName)
-
-
Method Detail
-
getConstraintName
public @Nullable String getConstraintName()
Returns the name of the violated constraint, if known.- Returns:
- The name of the violated constraint, or null if not known.
-
-