java 获取insert的自增长id

可以在 .xml中 <insert></insert>里面加入 useGeneratedKeys="true" keyProperty="id"  ,就想这样<insert useGeneratedKeys="true" keyProperty="id"></insert>。

就可以在后台直接用entity.getId获取insert 自增长的id。

猜你喜欢

转载自www.cnblogs.com/lyp0606/p/10052206.html
今日推荐