Hi,
I'm trying to prefetch a collection and for each element in that
collection I want to prefetch a property that is also a collection.

The domain model is along the lines of

Assessment has a collection of Assessors.  Each Assessor has a
collection of Responses.  I'm applying a prefetch strategy such as:

return criteria
                .SetFetchMode("Assessors", FetchMode.Eager)
                .SetFetchMode("Assessors.Responses", FetchMode.Eager)

This generates the correct SQL (thanks NHibernate Profiler), but when
I examine my entity after loading it's loaded duplicate entries.  I'm
testing it on an Assessment that has a single Assessor who has two
Responses.

The Assessors collection on the Assessment has an Assessor per
Response (i.e. two) rather than a single assessor with two responses
as expected.

I've tried the DistinctRootEntityTransformer, but as I expected it
didn't really work as I'm getting a single distinct root entity (the
Assessment).

Is it possible to do what I'm trying to do?

Thanks,
Matt

--

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