The code successfully creates the tables, creates address records for the employees, creates all the employee records, but then fails on inserting a phone record even though it has a valid FK reference to a employee record. I simplified the code so that it executes, persists and commits everything up to the point of the failure, but whether I execute the insert through JPA or manually by running a SQL script, I end up with the same 1452 error.

Interestingly, I found that if I dropped all the related Employee entities, and recreate them off create table definitions reversed engineered by MySQL workbench, I am able to successfully insert records into all the tables through JPA and manually via scripts. So, this suggests Eclipselink is creating the tables in some way that is producing a problem, and MySQL Workbench isn't capturing these problematic definitions in the reverse engineering. At this point, I'm out of ideas.
]]>No real name2011-02-26T17:47:33-00:00Re: Foreign Key Constraint Issue Involving One-To-Many and Many-To-One Relationship in EcliplseLink2https://www.eclipse.org/forums/index.php/mv/msg/205224/656787/#msg_656787
http://www.eclipse.org/forums/index.php?t=msg&goto=65678 6&S=139916fb892c4b1a5bfb97aa7b0e7079#msg_656786]]>Chris Delahunt2011-02-28T15:30:51-00:00