Module jakarta.data

Class NonUniqueResultException

All Implemented Interfaces:
Serializable

public class NonUniqueResultException extends DataException

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 Details

    • NonUniqueResultException

      public NonUniqueResultException(String message)
      Constructs a new NonUniqueResultException exception with the specified detail message.
      Parameters:
      message - the detail message.
    • NonUniqueResultException

      public NonUniqueResultException(String message, Throwable cause)
      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

      public NonUniqueResultException(Throwable cause)
      Constructs a new NonUniqueResultException exception with the specified cause.
      Parameters:
      cause - the cause.