数据库
首页 > 数据库> > 外键添加失败:java.sql.SQLException: Cannot add or update a child row: a foreign key constraint fails

外键添加失败:java.sql.SQLException: Cannot add or update a child row: a foreign key constraint fails

作者:互联网

错误代码

java.sql.SQLException: Cannot add or update a child row: a foreign key constraint fails (book.t_order_item, CONSTRAINT t_order_item_ibfk_1 FOREIGN KEY (order_id) REFERENCES t_order (order_id)) Query: insert into t_order_item(name,count,price,total_price,order_id)values(?,?,?,?,?) Parameters: [Java编程思想, 1, 100, 100, 1234511]

尝试根据错误信息排错

解决办法

标签:fails,java,constraint,外键,order,key,id
来源: https://www.cnblogs.com/liuzhixian666/p/14203452.html