-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping many-to-one with foreign primary key
PostPosted: Tue Nov 27, 2007 5:36 am 
Newbie

Joined: Tue Nov 27, 2007 5:29 am
Posts: 9
Hi! I've been wondering what would be the best way to map this legacy db structure. I've got two tables;

TABLE first (
event_id DECIMAL(22, 0) NOT NULL,
file_id VARCHAR(20) NULL,
PRIMARY KEY (`event_id`)
)

TABLE second (
event_id DECIMAL(22, 0) NOT NULL,
xml_schema VARCHAR(200) NULL,
CONSTRAINT `fk` FOREIGN KEY `fk` (`event_id`)
REFERENCES `first` (`event_id`)
)

So first 1-m second.

How would you represent using annotations? Table second doesn't have any primary key specified.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 27, 2007 7:04 am 
Newbie

Joined: Tue Nov 27, 2007 5:29 am
Posts: 9
Got an idea, could this mapped with @CollectionOfElements ?


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

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.