micronaut-projects / micronaut-data

Ahead of Time Data Repositories
Apache License 2.0
459 stars 196 forks source link

Add parameterized limit support to smart query finder methods - findTopN(int limit) - rather than static findTop5() #2945

Open mshannongit opened 1 month ago

mshannongit commented 1 month ago

Feature description

At the moment, it seems the only way to supply a dynamic parameterized limit value is by using a customized @Query

@Query(value = "SELECT * FROM books b WHERE b.title LIKE :title LIMIT :limit) List findBooks(String title, int limit);

It would be good if a dynamic limit value could be inferred based on method name

List findTopNBooksByTitle(String title, int limit);