Hi,
First, sorry for my english, I'm a french developper.
I have a problem to make a query. I hope you will understand it :
Imagine those tables (It's just an example) :
#Party
id (int)
label (string)
#Person
id (int)
id_party (int - foreign key Party)
name (string)
#Object
id (int)
id_person (int - forein key Person)
object (string)
At each Party, we note who is there, and for each person, all the
object deposed at the cloakroom.
I want to do the following request :
I want to get the party number 4, and each person who were there, and
each object for each person.
I want to get the following collection in 1 request :
Party (4, "Party at Paris")
----- Person ("Thomas")
-------------- Object ("Shoes")
-------------- Object ("Key")
----- Person ("Mathieu")
-------------- Object ("Red Jacket")
----- Person ("John")
-------------- Object ("Bag")
-------------- Object ("Blue Jacket")
I do it (aproximatively) :
session.CreateCriteria<Party>()
.SetFetchMode("Person", FetchMode.Eager)
.SetFetchMode("Person.Object", FetchMode.Eader)
.Add(Expression.Eq(ID, 4))
.List<Party>();
The problem is that the collection is not OK. There is multi Party,
multi Personn, etc.
I try to add .SetResultTransformer(new
DistinctRootEntityResultTransformer()) but it only make the root
distinct (party). The party contains 5 person (Thomas x 2, Mathieu x1,
John x2).
Can you try to give my tips ?
Thanks a lot for my poor english, but I think a post on your blog
about this request can help the community.
Thanks in advance,
Sincerely,
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---