Package org.hibernate
Class NonUniqueResultException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
jakarta.persistence.PersistenceException
org.hibernate.HibernateException
org.hibernate.NonUniqueResultException
- All Implemented Interfaces:
Serializable
Thrown when the application calls
Query.getSingleResult()
or
Query.uniqueResult()
and the query returns more than one row
from the database. Unlike every other exception thrown by Hibernate,
this one is recoverable!- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNonUniqueResultException
(int resultCount) Constructs aNonUniqueResultException
. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
NonUniqueResultException
public NonUniqueResultException(int resultCount) Constructs aNonUniqueResultException
.- Parameters:
resultCount
- The number of actual results.
-
-
Method Details
-
getResultCount
public int getResultCount()Get the number of actual results.- Returns:
- number of actual results
-