Hi,
I've seen this topic discussed in a previous thread - but the same conditions don't appear to apply to my problem. I am using mysql 5 and hibernate tools 3.24
I have the following table defined
CREATE TABLE `category` ( `CategoryID` bigint(20) NOT NULL, `Category` varchar(120) DEFAULT NULL, `SectionID` bigint(20) DEFAULT NULL, PRIMARY KEY (`CategoryID`), KEY `SectionID` (`SectionID`), CONSTRAINT `category_ibfk_1` FOREIGN KEY (`SectionID`) REFERENCES `section` (` SectionID`) ON DELETE NO ACTION ON UPDATE NO ACTION)
After running hibernate reengineering tools, table now looks like this
CREATE TABLE `category` ( `CategoryID` bigint(20) NOT NULL, `Category` varchar(120) DEFAULT NULL, `SectionID` bigint(20) DEFAULT NULL, PRIMARY KEY (`CategoryID`), KEY `SectionID` (`SectionID`), KEY `FK302BCFEE2FAD9F4` (`SectionID`), CONSTRAINT `FK302BCFEE2FAD9F4` FOREIGN KEY (`SectionID`) REFERENCES `section` (`SectionID`), CONSTRAINT `category_ibfk_1` FOREIGN KEY (`SectionID`) REFERENCES `section` (` SectionID`) ON DELETE NO ACTION ON UPDATE NO ACTION )
So Hibernate tools appears to added an extra constraint and an extra key - duplicating the ones already there. If I run it again it will add them again.
Is there anyway I can tell the tool not to generate any extra keys or foreign contraint? or anyway I can define the table such that this won't happen?
Thanks
James Thornley
|