-->
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: embedded composite identifier vs indetifier component
PostPosted: Thu Mar 09, 2006 2:20 pm 
Newbie

Joined: Thu Mar 09, 2006 12:56 pm
Posts: 1
Location: London, UK
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?


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.