-->
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.  [ 2 posts ] 
Author Message
 Post subject: Design question...
PostPosted: Mon May 22, 2006 3:51 am 
Newbie

Joined: Tue Mar 07, 2006 4:56 am
Posts: 17
Hallo together,

I have a small design problem using nHibernate and I would like to know, how you would go about to solve this problem.

I got a user object. This user object owns a collection of address data (e.g. shipping address, billing address, etc.). This by itself is not a problem. However, I like to "version" the address data. Meaning, if something in the address data changes, I want to produce a new copy of this object and create a new record for it in the database.

I still want to be able to associate the old record with the current user, though. And if at all possible, be able to revert the changes made by pointing back at the old record.

The reason behind this is, that we can figure out when and what kind of changes have been done to this data.

Does anyone have a good idea how to implement this relatively easy with nHibernate?

Kind regards, Marco...


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 6:24 am 
Newbie

Joined: Wed Dec 21, 2005 6:41 am
Posts: 2
Let the key of the address entity be a composite key containing the customerId and a version number (, and maybe a surrogoate key):

Code:
Address {
  //surrogoate key
id;

  // Composite key
  customerId;
  versionId;

  // Address stuff
  ...

}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.