I'm having trouble deciding how to model this relationship. My application has users who will comunicate with each other using a pair of email addresses specifically for them (so they can email eachother without disclosing their real address). So I have the folowing table:
Code:
create table EmailAddressPair
(
UserID1 int unsigned not null references User(ID),
UserID2 int unsigned not null references User(ID),
Address1 varchar(20) not null,
Address2 varchar(20) not null,
primary key (UserID1, UserID2)
)
I've read sections 5.1.5 and 8.4 and they seem to encourage creating an identifier component and discourage using an embedded composite identifier. My question is, if the reason not to use an embedded composite identifier is that you have to create an instance of the object before you can load the persistent state, how is that any worse than using an indentifier component? In the first case I create and instance of EmailAddressPair before loading it, and in the second case I have to create an instance of EmailAddressPairId. Is there really that much difference, or am I completely missing something?