Data truncation: Out of range value for column 'id' at row 1 ### The

org.springframework.dao.DataIntegrityViolationException: 
### Error updating database.  Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'id' at row 1
### The error may involve com.baomidou.springwind.mapper.ActivityMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO activity   ( id,  title,  tag,  content,      `state`,    add_time,  update_time,  places,  deposit,  full_price )  VALUES   ( ?,  ?,  ?,  ?,      ?,    ?,  ?,  ?,  ?,  ? )
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'id' at row 1
; SQL []; Data truncation: Out of range value for column 'id' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'id' at row 1

 

 

解决办法: 数据库 主键id 类型由int改为 bigInt

转载于:https://www.cnblogs.com/thinkingandworkinghard/p/6832334.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 当出现"Data truncation: Out of range value for column 'stock' at row 1"的错误时,意味着在向数据库添加或修改数据时,操作的值超出了该字段的取值范围。根据引用\[2\]中的信息,不同类型的字段有不同的取值范围。对于整数类型的字段,比如INT,其取值范围是从负的最小值到正的最大值。如果操作的值超出了这个范围,就会出现超出范围的错误。另外,根据引用\[3\]中的信息,如果字段的长度声明不正确,也可能导致超出范围的错误。因此,当出现"Data truncation: Out of range value for column 'stock' at row 1"的错误时,您需要检查操作的值是否在字段的取值范围内,并确保字段的长度声明正确。 #### 引用[.reference_title] - *1* [Spring 最全入门教程详解](https://blog.csdn.net/weixin_44863237/article/details/131489611)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [Data truncation: Out of range value for column ‘xxx‘ at row 1](https://blog.csdn.net/weixin_45399695/article/details/124265006)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [Data truncation: Out of range value for column `xxx`(MySQL的字段长度和取值范围踩坑)](https://blog.csdn.net/zgdwxp/article/details/100988201)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值