这是批量添加图片的测试,不太懂怎么操作,而后面的那个productDao测试也发生了类似的错误,好像都是数据的异常
org.springframework.dao.DataIntegrityViolationException:
020
.tb_product_img
, CONSTRAINT fk_proimg_product
FOREIGN KEY (product_id
) REFERENCES tb_product
(product_id
))020
.tb_product_img
, CONSTRAINT fk_proimg_product
FOREIGN KEY (product_id
) REFERENCES tb_product
(product_id
)); Cannot add or update a child row: a foreign key constraint fails (020
.tb_product_img
, CONSTRAINT fk_proimg_product
FOREIGN KEY (product_id
) REFERENCES tb_product
(product_id
)); nested exception is java.sql.SQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (020
.tb_product_img
, CONSTRAINT fk_proimg_product
FOREIGN KEY (product_id
) REFERENCES tb_product
(product_id
))
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:246)
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程