著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:林小米
链接:http://www.zhihu.com/question/20810321/answer/17086431
来源:知乎

useGeneratedKeys="true" 可以获取自增长的ID 只支持具有自增长方式的那种数据库(mysql, mssql 等 但 oracle 就不支持了 ) 
所以可以使用selectKey来获取
<insert >
   insert into table(...) values (...)
   <selectKey resultType="long" order="AFTER" keyProperty="id">
	SELECT LAST_INSERT_ID() AS id
   </selectKey>
</insert>

相关文章:

  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2021-12-01
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-29
  • 2021-09-20
相关资源
相似解决方案