@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.