Querydsl Limit Record Example

Querydsl Limit Record Example

I need to select limit record by querydsl, my query is like:

select *from <table> where <column_id> = 5 limit 2

How can I do a query in my repository interface method to the given above query?

1 Answer

Use QueryDslPredicateExecutor.findAll(Predicate predicate, Pageable pageable) and then get the actual results back using PageRequest.of(0, limit).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.