Hi,
I have a bit of a problem with the constraints in my database and how hibernate manages them asd would appreciate andy help or just a place to go to find the solution, thanks. This is how I got to the problem..
1. created schema with hibernate
2. added data in to schema
3. need to export partial tables from DB as they contain the importatnt data
4. import the export into new database
5. Let hibernate create remaining tables on new database.
6. Errors
These are the errors,
Code:
11:35:08,316 DEBUG SchemaUpdate:149 - alter table jforum_groups add index FK80BB241C6B459AD9 (parent_id), add constraint FK80BB241C6B459AD9 foreign key (parent_id) references jforum_groups (group_id)
11:35:08,394 DEBUG NewPooledConnection:430 - com.mchange.v2.c3p0.impl.NewPooledConnection@1a95a1d handling a throwable.
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add or update a child row: a foreign key constraint fails (`football/#sql-580_2be`, CONSTRAINT `FK80BB241C6B459AD9` FOREIGN KEY (`parent_id`) REFERENCES `jforum_groups` (`group_id`))
11:35:08,441 ERROR SchemaUpdate:155 - Unsuccessful: alter table jforum_groups add index FK80BB241C6B459AD9 (parent_id), add constraint FK80BB241C6B459AD9 foreign key (parent_id) references jforum_groups (group_id)
11:35:08,441 ERROR SchemaUpdate:156 - Cannot add or update a child row: a foreign key constraint fails (`football/#sql-580_2be`, CONSTRAINT `FK80BB241C6B459AD9` FOREIGN KEY (`parent_id`) REFERENCES `jforum_groups` (`group_id`))
I think that hibernate wants to add indexes to the tables that I created from the import. Also the import script had constraints named in them and I believe that they may be conflicting as hibernate would no longer use those names.
Any help would be greatfully apreciated.