Take a look at section 6.8 Bidirectional Associations in the NHibernate Reference Documentation, i think the explanation there will help you understand:
https://www.hibernate.org/hib_docs/nhibernate/html/collections.html -- Jakob Tikjøb Andersen On Thu, Aug 6, 2009 at 5:11 PM, Cesar Sanz <[email protected]>wrote: > > To tell the truth, I don't get it.. > > When should I use Inverse and when not?? > > I've tried to figure it out but no luck,... > > besides, when I mark a relation with Inverse = true, strange things happens > when I update or save entities. > > ----- Original Message ----- > From: "Nexus" <[email protected]> > To: "nhusers" <[email protected]> > Sent: Thursday, August 06, 2009 1:41 AM > Subject: [nhusers] Re: Inverse attribute? > > > > > > David, > > > > The problem you are facing is the difference between inverse option > > and cascading options !!! > > > > Specify inverse=true for each collection that you have a different > > mapping file for, this means that when the schema gets created he > > needs to investigate the underlying class for all constraints, fields > > etc !!! > > > > Cascade is synchronisation to db behavior, inverse has nothing to do > > with that. > > > > Kind regards > > > > On 5 aug, 15:44, Imajeep <[email protected]> wrote: > >> I am trying to understand the 'inverse' attribute. Reading from > >> 'NHibernate in Action' at the bottom of page 89: > >> > >> "By specifying inverse=true, you explicitly tell NHibernate which end > >> of [a bidirectional association] it should synchronize with the > >> database. In this example, you tell NHibernate that it should > >> propagate changes made at the Bid end of the association to the > >> database, ignoring changes made only to the bids collection. If you > >> only call item.Bids.Add(bid), no changes are made persistent." > >> > >> I'm puzzled by this statement. At the top of page 90, the book says > >> "When you instantiate a new bid and add it to an item, the bid should > >> become persistent immediately." > >> > >> The two statements seem to contradict each other. What does the first > >> statement, about ignoring changes to the bids collection, really mean? > >> Does it mean that if I delete a Bid from the bids collection, the > >> deletion won't be synchronized back to the database if I pass the item > >> to ISession.SaveOrUpdate()? > >> > >> Thanks for your help, > >> > >> David Veeneman > >> Foresight Systems > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
