I need some help. I have a db structure like this

Categories <-> OfferCategory (link table) <-> Offer <-> OfferLocation
(link table) <-> Location

I'm try to load a list of Offers, filtered on a column in Location,
and Eager Loading both Categories and Locations.

This is what I've tried...

      var offers = Session
                   .CreateCriteria(typeof(Offer))

                   .CreateCriteria("OfferCategories",
JoinType.LeftOuterJoin)
                     .SetFetchMode("Category", FetchMode.Eager)

                   .CreateCriteria("OfferLocations",
JoinType.LeftOuterJoin)
                     .SetFetchMode("Location", FetchMode.Eager)

                   .CreateCriteria("Location")
                     .Add(Expression.Eq("ZipCode", zipCode))
                  .List<Offer>();

The then get an error "could not resolve property: OfferLocations of:
XXX.OfferCategory", which is correct...OfferLocations is a member of
Offer, not of OfferCategory.  I know that this has to do with the
nested CreateCriteria, but I can't figure out how I should structure
the query to get it to do what I want.

Any advice?
--~--~---------~--~----~------------~-------~--~----~
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