-
Jul 19th, 2010, 07:40 PM
#1
Foreign Key constraint fails
I am attempting to set up a relationship that resembles the example under the 'hint relationships' command. Instead of an Order with lineItems, I have a GolfCourse with scorecards relationship.
I am getting the following exception:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityCons traintViolationException: Cannot add or update a child row: a foreign key constraint fails (`handicaptracker`.`scorecard`, CONSTRAINT `FK7EEC20A258736E` FOREIGN KEY (`id`) REFERENCES `scorecard` (`id`))
I can see that a foreign key is created on the (id) field on the scorecard table. When I remove that foreign key, I can manually add records.
Is there something I need to do to modify the way I'm setting up the relationship?
*********************
field set --fieldName scorecards --class GolfCourse --element Scorecard --mappedBy golfCourse
field reference --fieldName golfCourse --class Scorecard --type GolfCourse --notNull
*********************
Software Versions Used:
<roo.version>1.1.0.M2</roo.version>
<spring.version>3.0.3.RELEASE</spring.version>
<aspectj.version>1.6.10.M1</aspectj.version>
MySQL Server 5.1
persistence setup --provider HIBERNATE --database MYSQL
Thank you in advance!
K
-
Jul 21st, 2010, 04:48 AM
#2
This appears to be the same issue as reported in ROO-873.It only happens with MySql and there is no solution as yet. You can re-open the problem and we will have a look again. Also, please test using PostgreSQL and see if it works.
Alan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules