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: One-to-many mapping with no PK's?
PostPosted: Mon Nov 02, 2009 10:53 am 
Newbie

Joined: Fri Jul 28, 2006 10:53 am
Posts: 15
Normally one-to-many mappings in Hibernate are done through a FK column on one table referencing a PK column on another table. My dilemma is, the table that the FK column would normally be pointing to has been replaced with a view that doesn't really have any PK's (though that former PK column is still there). How do I declare that one-to-many mapping in HBM XML now?

Example:

create table correspondence_view (number correspondence_date not null, number email_correspondence_id, number phone_correspondence_id, ...)
create table email_correspondence_attachment (number email_correspondence_attachment_id primary key, number email_correspondence_id not null, ...)

The mapping is from email_correspondence_attachment.email_correspondence_id to correspondence_view.email_correspondence_id. All I really need is a "emailCorrespondenceAttachments" collection on my CorrespondenceView class.

I have to imagine this is possible, but so far nothing I've tried has worked. Any help would be greatly appreciated!


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.