Package jakarta.data.exceptions
Class NonUniqueResultException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
jakarta.data.exceptions.DataException
jakarta.data.exceptions.NonUniqueResultException
- All Implemented Interfaces:
Serializable
This exception is raised when execution of a repository method with a singular
return type finds multiple results. To avoid raising an error for this, you can
use the
findFirst...
method name pattern or supply
Limit.of(1)
as a parameter to explicitly request only the first result.- See Also:
-
Constructor Summary
ConstructorDescriptionNonUniqueResultException
(String message) Constructs a new NonUniqueResultException exception with the specified detail message.NonUniqueResultException
(String message, Throwable cause) Constructs a new NonUniqueResultException exception with the specified detail message.Constructs a new NonUniqueResultException exception with the specified cause. -
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
Constructs a new NonUniqueResultException exception with the specified detail message.- Parameters:
message
- the detail message.
-
NonUniqueResultException
Constructs a new NonUniqueResultException exception with the specified detail message.- Parameters:
message
- the detail message.cause
- another exception or error that caused this exception. Null indicates that no other cause is specified.
-
NonUniqueResultException
Constructs a new NonUniqueResultException exception with the specified cause.- Parameters:
cause
- the cause.
-