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.
This error can be circumvented by applying the @First
annotation
to a repository Find or Query method to explicitly request
that at most one result be returned. Alternatively, if using the Query by
Method Name pattern, the findFirst... method name pattern can be used
to explicitly request that at most one result be returned.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNonUniqueResultException(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.
-