Hi,

I’m working on the design of a new project and I was considering using
nHibernate as my ORM.  However, I have a specific need and I’m unsure
whether nHibernate can answer the call.

I would like to do client-side composition.

Given those premises:
•       I have the classes Parent, Child and GrandChild, with appropriate
collection properties.
•       Each of those classes have a property Name.
•       I have already loaded a Parent called “parent1”.
•       “parent1” has 100 Child already loaded, with names “child1”,
“child2”, …, “child100”.
•       No GrandChild is loaded yet.
•       Suppose each Child owns 10 GrandChild objects, although we don’t
know it yet since GrandChild aren’t loaded yet, for a total of 1000
GrandChild.

I want to load GrandChild objects, given the Parent’s Name “parent1”.
What I want is to get all 1000 GrandChild from my web service and
compose them client-side with my 100 Child objects based on the
foreign key, because I don’t want to do 100 round-trips to the
backend.

If I was to write the SQL query for that, I would write something
similar to the following:

Select gc.Id, gc.ChildId, gc.Name
>From Parent p inner join Child c on p.Id = c.ParentId
     Inner join GrandChild gc on c.Id = gc.ChildId
Where p.Name = “parent1”

Then, I would compose each GrandChild object with its parent, using
the ChildId foreign key.

How would you resolve that problem with this nHibernate?

Thanks!
dave.

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

Reply via email to