Is it possible to get the @@identity from the SQL insert on a Spring jdbc template call? If so, how?
How about SimpleJdbcInsert.executeAndReturnKey? It takes two forms, depending on the input:
public java.lang.Number executeAndReturnKey(java.util.Mapargs) Description copied from interface: SimpleJdbcInsertOperations
Execute the insert using the values passed in and return the generated key. This requires that the name of the columns with auto generated keys have been specified. This method will always return a
KeyHolderbut the caller must verify that it actually contains the generated keys.Specified by:
executeAndReturnKey in interface SimpleJdbcInsertOperations
Parameters:
args - Map containing column names and corresponding valueReturns:
the generated key value
public java.lang.Number executeAndReturnKey(SqlParameterSourceparameterSource)Description copied from interface: SimpleJdbcInsertOperations
Execute the insert using the values passed in and return the generated key. This requires that the name of the columns with auto generated keys have been specified. This method will always return a
KeyHolderbut the caller must verify that it actually contains the generated keys.Specified by:
executeAndReturnKey in interface SimpleJdbcInsertOperations
Parameters:
parameterSource - SqlParameterSource containing values to use for insertReturns:
the generated key value.