I’m using Spring JdbcTemplate interface for fetching data from a MS SqlServer DB.
In the documentation I see there is the setMaxRows() method to set a limit for all the queries, but what if I want to limit only a select?
Is there a way to set a limit only for a specific invoked query in a “configurable” way?
Limiting the result set of a specific query can be done by putting the limit directly into the query. Consult your DB vendor documentation to see if it supports for example
LIMIT.Example on MySQL:
SELECT * FROM EMPLOYEE LIMIT 10