参考:http://www.mybatis.org/core/java-api.html
This example shows using the @SelectKey annotation to retrieve an identity value after an insert:
@Insert("insert into table2 (name) values(#{name})") @SelectKey(statement="call identity()", keyProperty="nameId", before=false, resultType=int.class) int insertTable2(Name name);
本文介绍使用MyBatis的@SelectKey注解来获取插入操作后的自增ID值。示例展示了如何通过组合@Insert和@SelectKey实现这一功能。

被折叠的 条评论
为什么被折叠?



