Thanks for your reply. Your solution can work. Anyway, I will have the following issue: In my presentation layer I have a general view showing all the instances of Model B, but I want to show only the instances that are linked by other models, like B1. I don't want to show the instance B1' because this belongs only to A2 and I can edit it only from the view related to A2 and not from the general view. Thus I must to introduce something that differentiate linked instances from embedded instances, even if they have the same properties (they must have the same properties !). Maybe I could store both version in the same table and have a bit column that filters the linked instances, or have a table for linked instances and one for embedded instances. I am looking for the cleaner solution.
On Nov 23, 8:15 pm, Germán Schuager <[email protected]> wrote: > Hi, > maybe I didn't understood your scenario correctly, but I don't think that > the copy of B1 is a value object... it is just a new entity (B1') that is > only related to A2. Do you see a problem with this model? > > On Mon, Nov 23, 2009 at 11:47 AM, augusto.sansoni <[email protected] > > > > > wrote: > > Hi, I have the following design issue: I have two domain models: > > Model A and Model B. Both are entities, because they can stand on > > their own, but Model A can reference Model B in two ways: > > I) Instance A1 (an instance of Model A) POINTS TO Instance B1 (an > > instance of Model B). If Instance A1 changes a property of Instance > > B1, every instance of Model A are affected, so they will be linked to > > an updated version of Instance B1. > > > II) Instance A2 (an instance of Model A) CONTAINS a copy of Instance > > B1. Thus, if Instance A2 changes its copy of Instance B1, no other > > else instance of Model A will be affected because they will continue > > to point to Instance B1. > > > The question is: how can I manage, with NHibernate, a case where a > > domain model can be an entity and a value object at the same time ? > > > -- > > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<nhusers%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
