C
carmelo
Hi everybody,
I'm developing a Swing CRUD application with a master/details form,
using Toplink JPA, MySQL and Netbeans 6.7.1. Master/details tables
are:
- master(code_auto_incr, master_code)
- details(code_auto_incr, description, master_code)
There is a foreign key constraint which relates details.master_code
to master.master_code
The problem is that I get an exception on insert:
javax.persistence.RollbackException: Exception [TOPLINK-4002] (Oracle
TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))):
oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Cannot add or update a child row: a foreign key constraint fails
(`my_database/details`, CONSTRAINT `FK_details` FOREIGN KEY
(`master_code `) REFERENCES `master` (`master_code `))
Error Code: 1452
Call: INSERT INTO my_database.details(code_auto_incr, description,
master_code) VALUES (?, ?, ?)
bind => [1, 1, 0]
Query: InsertObjectQuery(master.Details
I'm developing a Swing CRUD application with a master/details form,
using Toplink JPA, MySQL and Netbeans 6.7.1. Master/details tables
are:
- master(code_auto_incr, master_code)
- details(code_auto_incr, description, master_code)
There is a foreign key constraint which relates details.master_code
to master.master_code
The problem is that I get an exception on insert:
javax.persistence.RollbackException: Exception [TOPLINK-4002] (Oracle
TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))):
oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:
Cannot add or update a child row: a foreign key constraint fails
(`my_database/details`, CONSTRAINT `FK_details` FOREIGN KEY
(`master_code `) REFERENCES `master` (`master_code `))
Error Code: 1452
Call: INSERT INTO my_database.details(code_auto_incr, description,
master_code) VALUES (?, ?, ?)
bind => [1, 1, 0]
Query: InsertObjectQuery(master.Details
Code:
)
How can I do? Please help me.
Thank you very much in advance for your help