-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: reengineering tools creating foreign keys
PostPosted: Tue Mar 16, 2010 8:38 am 
Newbie

Joined: Tue Mar 16, 2010 8:24 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.