23 Aralık 2022 Cuma

SpringData JpaRepository Derived Query - Limiting Derived Query Results

Giriş
Açıklaması şöyle
The results of derived query methods can be limited by using the First or Top keywords interchangeably. An optional numeric value can be added to Top or First to specify the maximum number of results to be returned. If the number is not provided, a result size of 1 is used.

The following examples show how to limit the derived query result size:

User findFirstByOrderByName();

User findTopByOrderByAgeDesc();

List<User> findFirst5ByEmail(String email);

List<User> findDistinctTop3ByAgeLessThan(int age);
Yani
- First
- Top
- TopX
- Distinct
- DistinctTopX
olabilir

Hiç yorum yok:

Yorum Gönder