Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of range value for column 'id' at row 1 #186

Closed
wengeqiua opened this issue Dec 29, 2020 · 5 comments
Closed

Out of range value for column 'id' at row 1 #186

wengeqiua opened this issue Dec 29, 2020 · 5 comments

Comments

@wengeqiua
Copy link

wengeqiua commented Dec 29, 2020

环境信息

  • 系统: Windows 10
  • JDK: 1.8.0_41
  • 数据库: MySQL 8.0.15
  • APIJSON: APIJSON-Demo工程

问题描述

之前设计数据库没考虑id长度问题,现在导入apijson后,新增数据的时候报Out of range value for column 'id' at row 1,已知是id长度问题,因为换成bigint类型后就没问题, 但是之前设计的数据库都是int类型,如果要一个一个改工作量非常大,想问这种问题怎么解决?能不能让id自增长(id改成bigint后生成的id好像是时间戳?)?因为之前一直做前端的(需求只是简单的弄一个增删改查的功能,所以没后台),不知道怎么下手,求大佬帮忙

错误信息

@TommyLemon
Copy link
Collaborator

TommyLemon commented Dec 29, 2020

DemoSQLConfig static 代码块中重写 SIMPLE_CALLBACK 的 newId 方法,return null 即可
https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/demo/DemoSQLConfig.java
image

@wengeqiua
Copy link
Author

DemoSQLConfig静态代码块中重写SIMPLE_CALLBACK的newId方法,返回null即可
https://github.com/APIJSON/APIJSON-Demo/blob/master/APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/演示/DemoSQLConfig.java
图片

非常感谢

@Xuxin19960702
Copy link

环境信息

系统: Windows 7
JDK: 1.8.0_41
APIJSON数据库: MySQL 5.7
远程数据库:MySQL 5.5
APIJSON: APIJSON-MultiDataSource 6.0.0工程
问题描述

你好,DemoSQLConfig静态代码块中重写SIMPLE_CALLBACK的newId方法,返回null后。添加数据时候,仍未使用自增主键。

怀疑原因:是不是远程数据库版本的问题???

(不方便截图,见谅)
image
image

错误信息

@TommyLemon
Copy link
Collaborator

@Xuxin19960702 你是怎么判断没有自增的?最上方两条也是连续的,再添加记录,最新的记录 id 也应该为之前最大 id + 1

@Xuxin19960702
Copy link

@Xuxin19960702 你是怎么判断没有自增的?最上方两条也是连续的,再添加记录,最新的记录 id 也应该为之前最大 id + 1

确实是我魔怔了,昨晚后来我也发现这个问题了,就改当前自增id了,但数据库有点问题,手动insert都改不过来。今早重新改了下自增id,居然就好了。

非常感谢!麻烦了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants