Open
Description
As a ...
- Application user/user of the configuration itself
- API user (application developer)
- SPI user (container or runtime developer)
- Specification implementer
I need to be able to ...
statically specify a limit at development time
Which enables me to ...
write a repository method with a singular return type (Optional<MyEntity>
or MyEntity
).
Additional information
This is currently only possible (and awkwardly so) with Query by Method Name.
To allow it with @Query
and parameter based queries (@Find
), we can add First
(proposed by Gavin in #530 (comment))
@Find @First
@OrderBy(value = _Employee.SALARY, descending = true)
@OrderBy(value = _Employee.ID)
Optional<Employee> highestPaid(String jobTitle);
The value would default to 1
.
Reminder to update recommendations in NonUniqueResultException
once we have this.
This is being proposed for after Jakarta Data version 1.0.