Package org.hibernate
Class NonUniqueObjectException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- jakarta.persistence.PersistenceException
-
- org.hibernate.HibernateException
-
- org.hibernate.NonUniqueObjectException
-
- All Implemented Interfaces:
Serializable
public class NonUniqueObjectException extends HibernateException
This exception is thrown when an operation would break session-scoped identity. This occurs if the user tries to associate two different instances of the same Java class with a particular identifier, in the scope of a single Session.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NonUniqueObjectException(Object entityId, String entityName)Constructs aNonUniqueObjectExceptionusing the given information, and using a standard message.NonUniqueObjectException(String message, Object entityId, String entityName)Constructs aNonUniqueObjectExceptionusing the given information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetEntityName()ObjectgetIdentifier()StringgetMessage()-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
NonUniqueObjectException
public NonUniqueObjectException(String message, Object entityId, String entityName)
Constructs aNonUniqueObjectExceptionusing the given information.- Parameters:
message- A message explaining the exception conditionentityId- The identifier of the entityentityName- The name of the entity
-
-
Method Detail
-
getEntityName
public String getEntityName()
-
getIdentifier
public Object getIdentifier()
-
getMessage
public String getMessage()
- Overrides:
getMessagein classThrowable
-
-