|
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!
|