Hello, I have a Load table and a Customer Table and a Load Type table.
Now Load table has a foreign Key to both Customer table and Load Type table. So basically in the Load object that gets generated using Mygeneration tool, I get a properties of Customer object and LoadType object and in the Load.hbm.xml we have the follwoing <many-to-one name="LoadType" cascade="save-update" column="`LoadtypeId`"></many-to-one> <many-to-one name="Customer" cascade="save-update" column="`CustomerId`" /> Now when I insert, a new row into the Load table using Nhibernate, in order for the foreign keys ( customerId and loadTypeid ) to get populated ( with existing rows in the Customer and LoadTypetable ) should I always need to retrieve the existing cutomer object and existing Loadtype object and then add to the Load object and do a Save() on it ? Is there any way I can just insert the CustomerId and LoadTypeID like Load Ld = new Load(); Ld.Customer = 1; Ld.LoadType = 2; instead of Load Ld = new Load(); Ld.Customer = CustomerDataProvider.GetById(1); Ld.LoadType = LoadTypedataProvider.GetbyId(2); Hoping for some help and thanks in advance. Ashwin -- 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.
