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

UNSIGNED BIGINT(20)映射问题 #613

Closed
heardfate opened this issue Nov 7, 2018 · 1 comment
Closed

UNSIGNED BIGINT(20)映射问题 #613

heardfate opened this issue Nov 7, 2018 · 1 comment

Comments

@heardfate
Copy link

当前使用版本(必须填写清楚,否则不予处理)

com.baomidou mybatis-plus-boot-starter 3.0.5

该问题是怎么引起的?(注意!!!请使用最新版(具体版本查看CHANGELOG.md),如还有该问题再提 issue!,否则直接拒绝,毫不商量!!!)

数据库ID字段使用UNSIGNED BIGINT(20)类型,手动在数据库存储ID值为18446744073709551615
JAVABEAN 下ID映射成 private Long id;
获取数据:报错java.sql.SQLDataException: Value '18,446,744,073,709,551,615' is outside of valid range for type java.lang.Long 越界类
插入数据:正常

JAVABEAN 下ID映射成 private BigInteger id;
获取数据:正常
插入数据:报错Could not set property 'id' of 'class XXX.entity.User' with value '1060015479998566402' Cause: java.lang.IllegalArgumentException: argument type mismatch

重现步骤

直接用默认生成器生成DAO,service,修改ID字段类型
数据库表用的就是demo的表

报错信息

数据库ID字段使用UNSIGNED BIGINT(20)类型,手动在数据库存储ID值为18446744073709551615
JAVABEAN 下ID映射成 private Long id;
获取数据:报错java.sql.SQLDataException: Value '18,446,744,073,709,551,615' is outside of valid range for type java.lang.Long 越界类
插入数据:正常

JAVABEAN 下ID映射成 private BigInteger id;
获取数据:正常
插入数据:报错Could not set property 'id' of 'class XXX.entity.User' with value '1060015479998566402' Cause: java.lang.IllegalArgumentException: argument type mismatch

@miemieYaho
Copy link
Member

你手动设置的超出了 long 的最大值, mp 的 idwork 是 long 型,强转失败

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

No branches or pull requests

2 participants