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);

你可能感兴趣的:(mybatis基于annotation的方式取得自增长ID值)