findFirst3By
FindFirst3By is a derived query method name used in Spring Data repositories to retrieve up to the first three entities that match the given criteria. It is part of Spring Data JPA (and other Spring Data modules) and relies on the method name to generate the corresponding query automatically from the domain model and repository interface.
How it works: The segment after By encodes property-based conditions, connected with And or Or. The number
Examples: List<User> findFirst3ByStatusOrderByCreatedDateDesc(String status); This returns up to three users with the given status, ordered by
Return type and alternatives: The typical return type is List<T>. If fewer than three matches exist, the
Limitations: The result’s order should be explicitly defined to be deterministic. The method name approach depends