Spring JDBC - Last inserted id

前端 未结 2 1909
不知归路
不知归路 2021-01-16 06:46

I\'m using Spring JDBC. Is a simple way to get last inserted ID using Spring Framework or i need to use some JDBC tricks ?

jdbcTemplate.update(\"insert into          


        
相关标签:
2条回答
  • 2021-01-16 07:18

    The old/standard way is to use call currval() after the insert (ref). Simple and secure.

    0 讨论(0)
  • 2021-01-16 07:23

    Support for "generated keys for PreparedStatements" started only since PostgreSql Ver 8.4-701.

    0 讨论(0)
提交回复
热议问题