After reading up some more on stack overflow and through hibernate (java, understanding this is a port) documentation, that it may be possible to specify cascade behavior at the time of a call?
This would seem to be my best option because i know what cascade setting i need at the time it's added to the nhib session? I've also thought seriously about not letting nhib manage the collections - but then I fear I'll have problems saving a full graph of new entities (or more importantly, ensuring in-memory entities are solvent). ------ Joe Brockhaus [email protected] ------------ On Thu, Feb 10, 2011 at 9:55 AM, Jason Meckley <[email protected]>wrote: > @Jide: this type of approach is along the lines of CRUD instead of ORM. the > purpose of ORM is to work with objects, not a database. Therefore you would > load the entire object into memory. If you want to query specific columns > you are talking about projections. in ORM terms projections are a read-only > aggregation of the domain objects. the idea of ORM is to get the database > operations out of your way. Once you have a root object, you can traverse > the domain without thinking about how to query the data. once the domain > logic is working you can then optimize the query. > > in reference to Load(). This will create a proxy object. It assumes the > object does exist in the database. If it doesn't an exception will be thrown > when you access a member object. the instant you access a member of the > object NH will retrieve the entity from the database. > session.Load<Parent>(id).AddChild("jason"); > would retrieve the parent entity from the database when you add the child > to the children collection of the parent. this makes sense because > conceptually we are working with objects in the domain, not rows/colums in > the database. > > I find Load is helpful when entities are part of the criteria > var jason = session.Load<Child>(id); > var parents = session.CreateQuery("from parent where children > contains(:child)").SetParameter("child", jason).List(); > > > > -- > 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. > -- 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.
