Reputation: 3103
When I execute the following query, its work fine
jdbcTemplate.query("select * from foo Limit 50");
But when I want to try to execute the following query , it giving me syntax error even successfully running in mysql
jdbcTemplate.query("select SQL_CALC_FOUND_ROWS * from foo Limit 10; SELECT FOUND_ROWS()");
any update ?
Upvotes: 1
Views: 7263
Reputation: 9786
You can't execute two queries on a single query execution from the template. It expects (correctly) that a single execution of its corresponding method will execute a single query, and hence return a single result. The key point is the ;
character. I believe that's the cause of the syntax error, exactly because of what you are trying to do.
There are two ways to go around this:
If you choose the first approach and you want to synchronize you can check this link.
Upvotes: 3