cannot add or update a child row: a foreign key constraint fails
来源:百度知道 编辑:UC知道 时间:2024/06/19 00:05:32
麻烦一下 我的产品类型和产品一对多 产品和销售信息 一对多 销售商和销售信息 一对多 请问这个出现 Cannot add or update a child row: a foreign key constraint fails 大概是什么原因啊?麻烦一下 我的产品类型和产品一对多 产品和销售信息 一对多 销售商和销售信息 一对多 请问这个出现
2008-11-13 8:10:41 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 1452, SQLState: 23000
2008-11-13 8:10:41 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Cannot add or update a child row: a foreign key constraint fails (`forthtests/aasell`, CONSTRAINT `FKAB12CB72FE00B749` FOREIGN KEY (`sell_id`) REFERENCES `aabuy` (`buy_id`))
Exception in thread "main" org.hibernate.exception.ConstraintViolationException: could not insert: [model.Sell]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(
2008-11-13 8:10:41 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 1452, SQLState: 23000
2008-11-13 8:10:41 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: Cannot add or update a child row: a foreign key constraint fails (`forthtests/aasell`, CONSTRAINT `FKAB12CB72FE00B749` FOREIGN KEY (`sell_id`) REFERENCES `aabuy` (`buy_id`))
Exception in thread "main" org.hibernate.exception.ConstraintViolationException: could not insert: [model.Sell]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(
这个问题一定是由 销售信息 与 产品、销售商 之间的 外键关联造成的。
从错误讯息来看,有可能是你在保存或者修改一份 销售信息 的时候,没有填充 销售商 的讯息,或者填充了一个资料库中没有的 销售商 讯息。
希望你能描述一下你正在进行的操作。
如果用Hibernate处理资料表的关联十分棘手的话,你可以尝试删除资料库端的表关联,然后通过Hibernate的配置文件建立表关联,用程式端的表关联控制资料库端的表关联。
什么是cannot focus a disabled or invisible window
高手帮我翻译这句英语呀?Error 80040275 :Cannot add vidcap to filtergraph 是什么意思呀??
or you cannot remember clearly the desails of what is said
如何解决Cannot open include file: 'regex.h': No such file or directory
fatal error C1083: Cannot open include file: 'iostream': No such file or directory
What has four legs and a back but cannot walk or move on its own?
Cannot find import:DLL may be missing, corrupt, or wrong version Fie",error 126
Cannot open precompiled header file: 'Debug\09241.pch': No such file or directory
No matter the ending is perfect or not, you cannot disappear from my world.
ACDSee screen saver requires two or more images to run. please add more image with acdsee 帮忙啊