I have a relational table with the following definition:
CREATE TABLE heap (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
I would like to use SPRING RDBMS objects to insert rows (one at a time) into this table. I would like to use the function last_inserted_id() to get back the value of the id field. For this to work both the insert and the call to last_inserted_id() have to be performed on the same connection. Each RDBMS object establishes it own connection. So using two of these object, one for the insert, and one for the call to last_insered_id() does not work.
What would be the best way to perform both of these db operations through a single connection. I want to rely on SPRING as much as possible. Do I need to subclass jdbcTemplate? Or is there some elegant straightforward way to make this work.
Thanks in advance for any help.