美文网首页
SpringMVC+Mybatis各种踩坑记录

SpringMVC+Mybatis各种踩坑记录

作者: rebirthwyw | 来源:发表于2017-08-23 15:48 被阅读0次

update 2017-8-23

  • mybatis使用insert进行操作时要获得自增主键,如果parameterType不是object而是map的话,不能使用useGeneratedKeys的方式获得自增主键,需要使用<selectKey>的方式
    sqlserver下实践语句,注意放在insert语句之后,既order是after。
        <selectKey resultType="Integer" keyProperty="examId" >
          select @@IDENTITY as value
        </selectKey>

其他数据库未实践,可参考http://blog.csdn.net/weisong530624687/article/details/45688883
这是ibatis的,需微调。

相关文章

网友评论

      本文标题:SpringMVC+Mybatis各种踩坑记录

      本文链接:https://www.haomeiwen.com/subject/lboddxtx.html