首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ibatis序列号生成

Ibatis序列号生成
EN

Stack Overflow用户
提问于 2015-06-19 02:37:22
回答 1查看 541关注 0票数 0

我刚来Ibatis。如何使用Ibatis生成序列号并将其插入到mysql表中?序列号应以1000开头,以便它可以用作表中的主键。我使用了spring,ibatis和mysql。

EN

回答 1

Stack Overflow用户

发布于 2015-06-19 03:02:22

由于iBatis自2010年来就已经死亡,因此我推测MyBatis的使用情况。使用MyBatis you can use these annotations to insert and retrieve primary key from DB and map both to a interface

代码语言:javascript
复制
@Insert("insert into table2 (name) values(#{name})")
@SelectKey(statement="call identity()", keyProperty="nameId", before=false, resultType=int.class)
int insertTable2(Name name);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30923179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档