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. 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 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.