Posted in Spring JDBC

Get Auto-generated Id in Spring JDBC using SimpleJdbcInsert

Auro-generated Id In this post I will show you how to get auto generated id of a newly inserted row in table. Spring provides an easy way to get this auto-generated key using executeAndReturnKey() method of SimpleJdbcInsert which is supported Spring JDBC 3 onwards. For most of the records I will use auto generated Id value on database side to…

Continue Reading... Get Auto-generated Id in Spring JDBC using SimpleJdbcInsert
Posted in Spring JDBC

Auto-generated Id In Spring JDBC Using PreparedStatement

Generated Id In this post I will show you how to get auto generated id of a newly inserted row in table. Spring provides an easy way to get this auto-generated key using KeyHolder which is supported Spring JDBC 3 onward. I am going to use PreparedStatement to get the auto generated id value. For most of the records, I…

Continue Reading... Auto-generated Id In Spring JDBC Using PreparedStatement