This is the best place for questions... StackOverflow is great too (many people crosspost). And of course you can read the blogs of Oren (http://ayende.com/blog/), Fabio (http://fabiomaulo.blogspot.com/), José ( http://jfromaniello.blogspot.com/), Darío ( http://darioquintana.com.ar/blogging/), Steve ( http://blogs.imeta.co.uk/sstrong/Default.aspx) and others.
Diego On Sun, Mar 28, 2010 at 20:02, Ashwin <[email protected]> wrote: > Diego, > > Thanks a million, I was always worried about the extra DB calls ... I > can sleep peacefully now :). Thanks, again :D > > Also, can you recommend some forums or groups for Nhibernate or some > websites ( I know Summner of Nhibernate ) through which I can gian > knowledge. > > Thanks a loooooooooooooot :) > > You have really saved my day. > > Ashwin > > On Mar 28, 6:51 pm, Diego Mijelshon <[email protected]> wrote: > > Yes, when you have the id of the referenced object you can use, for > example > > session.Load<Customer>(customerId). > > This creates a proxy to the Customer with Id=customeId without going to > the > > DB; you can assign it to your new Load instance and save it without a > > problem. > > > > Recommended read: > http://ayende.com/Blog/archive/2009/04/30/nhibernate-ndash-the-differ... > > > > Diego > > > > > > > > On Sun, Mar 28, 2010 at 19:11, Ashwin <[email protected]> wrote: > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]>> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=en. > > -- > 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=en. > > -- 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.
