-->
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: Mapping a collection with a composite key
PostPosted: Thu Apr 02, 2009 12:40 pm 
Newbie

Joined: Thu Apr 02, 2009 11:12 am
Posts: 1
I have a db table (Contacts) whose contents are refreshed with new/updated data periodically. The table has an ident primary key, but it is rather worthless to use as a foreign key because the keys change everytime the data is refreshed. (wipe and reinserted)

For example, contact Joe Smith may have ID 7, but after a refresh could have ID 834678. Consequently, any table that needs to hold a foreign key to Joe Smith's contact record must use a composite key of sorts.

We are using "UniqueID" (string value) and "AccountID" (int value) to uniquely identifiy a contact. "UniqueID" *should* be unique within the context of a given "AccountID".

Because of varying data sources, Joe Smith could potentially have multiple records, each with the same "UniqueID" and "AccountID". So I'm dealing with a collection of contacts that should be identified by a faux (defined) composite key.

I'm a bit baffled as to how I can represent this collection to NH. Any ideas would be HUGELY appreciated.

Thanks,

John


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.