title: spring jdbctemplate returns 0 for last_insert_id()
body: <p>The code given below always returns zero for the last insert id. Can you please explain me what is wrong with this code?</p>
  
  <pre><code>JdbcTemplate insert = new JdbcTemplate(dataSource);
  
          insert.update("INSERT INTO item (price, item_category) VALUES(?,?)",
              new Object[] { beverage.getPrice(), beverage.getItemCategory() });
          int id = insert.queryForInt( "SELECT last_insert_id()" );
          System.out.println(id);
          return insert.update("INSERT INTO beverage (id, name, quantity,size) VALUES(?,?,?,?)", new Object[] { id,beverage.getName(), beverage.getQuantity(),beverage.getSize() });
  </code></pre>