obeckham 发表于 2016-11-27 08:03:46

mybatis基于annotation的方式取得自增长ID值


参考: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);
页: [1]
查看完整版本: mybatis基于annotation的方式取得自增长ID值