I'm using SELECT LAST_INSERT_ID()
to get the last auto-incremented value. It works fine from the SQLyog and command prompt but when I use the same query using Spring JdbcTemplate like this:
String SQl1="SELECT LAST_INSERT_ID()";
int sales_id=jdbcTemplateObject.queryForInt(SQl1);
System.out.println("returned sales_id is"+sales_id);
it returns 0 rather than the expected last auto-incremented value. How can I get the expected value ?