MySQL - Foreign key failure - but the problem is with Eclipse, I think...
I have created a database with 2 tables (actually 13 tables, but only 2 are involved with this..) One table contains a foreign key reference to the second table.
When I originally created the tables, I had a typo in the foreign key line. So instead of:
CONSTRAINT `dev_id` FOREIGN KEY (`dev_type`) REFERENCES `dev_type` (`id`)
CONSTRAINT `dev_id` FOREIGN KEY (`dev_type`) REFERENCES `rrd_dev_type` (`id`)
So when I tried to insert a record into the first table, I got an error like:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails ("vrsn_rrd"."rrd_info", CONSTRAINT "dev_id" FOREIGN KEY ("dev_type") REFERENCES "rrd_dev_type" ("id"))
So I fixed the typo, dropped the database, recreated the database and now from the command line, I can insert records. HOWEVER, I am working with a java program built with Eclipse to read my input and load this table, and when the program runs, I get the same foreign key error. I have deleted the program war file, deleted the project from Eclipse and recreated it, deleted the database again and rebuilt it, and I can't get the program to load my data.
I am completely inexperienced with Eclipse - I'm assuming it has cached something somewhere, but I can't find it. The fact that I can load a record from the mysql command line tells me the database is now ok.
Can someone give me a hint as to how to get rid of this problem? I am building the code using Eclipse and the Vaadin development environment.
Thanks very much,