加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

orm – Doctrine问题:无法获取最后一个插入标识符

发布时间:2020-12-14 23:36:08 所属栏目:Java 来源:网络整理
导读:当我尝试将数据保存到我的模型时,Doctrine会抛出此异常: Message: Couldn't get last insert identifier. 我的表设置代码是: $this-hasColumn('id','integer',4,array( 'type' = 'integer','length' = 4,'fixed' = false,'unsigned' = false,'primary' = t
当我尝试将数据保存到我的模型时,Doctrine会抛出此异常:
Message: Couldn't get last insert identifier.

我的表设置代码是:

$this->hasColumn('id','integer',4,array(
         'type' => 'integer','length' => 4,'fixed' => false,'unsigned' => false,'primary' => true,'autoincrement' => true,));

请帮忙.谢谢.

解决方法

检查以确保数据库中的列设置为auto_increment.看起来Doctrine类将它作为auto_increment处理,但它不是在DB中设置的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读