Could not execute JDBC batch update; SQL [delete from role where roleId=?]; constraint [null]; neste
来源:互联网 发布:淘宝店访客突然少了 编辑:程序博客网 时间:2024/06/05 13:03
今天在写多个删除功能的时候出现了这么一个错误:意思是删除操作的时候,没有找到对应的外键。
Cannot delete or update a parent row: a foreign key constraint fails (`ssh03`.`role_privilege`, CONSTRAINT `FK45FBD628F05C38CB` FOREIGN KEY (`role_id`) REFERENCES `role` (`roleId`))Cannot delete or update a parent row: a foreign key constraint fails (`ssh03`.`role_privilege`, CONSTRAINT `FK45FBD628F05C38CB` FOREIGN KEY (`role_id`) REFERENCES `role` (`roleId`))Could not execute JDBC batch updateCould not execute JDBC batch update; SQL [delete from role where roleId=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [delete from role where roleId=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
在网上找了很久,都没有找到对应的错误。。我的删除操作是先查找Role对象,再通过删除它。
后来debug起来又是匪夷所思的:后台能够得到外界传递过来的id
在查询对象的时候,就死活查不了外键的数据【让我搞了很久很久】。。
最后发现id上多了一个空格???????至于为什么多了一个空格,,我现在还不知道。。。于是把空格去掉,就解决这个bug了。。。
/*批量删除*/ public String deleteSelect() { for (String s : selectedRow) { roleServiceImpl.delete(s.trim()); } return "list"; }
….如果知道为什么会多出一个空格的,请在评论下告诉我….
阅读全文
1 0
- Could not execute JDBC batch update; SQL [delete from role where roleId=?]; constraint [null]; neste
- Could not execute JDBC batch update
- 再说Could not execute JDBC batch update
- SQLGrammarException: Could not execute JDBC batch update
- Could not execute JDBC batch update....
- Could not execute JDBC batch update问题
- Could not execute JDBC batch update
- Could not execute JDBC batch update
- Could not execute JDBC batch update
- Could not execute JDBC batch update
- Could not execute JDBC batch update
- Could not execute JDBC batch update
- Hibernate抛异常Could not execute JDBC batch update
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
- org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
- Could not execute JDBC batch update异常的解决办法
- org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
- HDU 2197 本原串 (数学+容斥)
- 持续集成Jenkins+sonarqube部署教程
- 自我反省
- 机器学习与TensorFlow编程(2)逻辑线性回归模型
- 搭建elk
- Could not execute JDBC batch update; SQL [delete from role where roleId=?]; constraint [null]; neste
- 用Mesos分布式架构进行工作
- qt国际化翻译
- 调用EAS单据转换规则(BOTP),生成下游单据
- 技术盛会 I/O,apple WWDC,Build
- matplotlib绘图基础--2
- UART接口介绍
- Java加密与解密学习记录06-数字签名算法
- wampsever3.0.6-apache2.4.23修改文件路径问题