NHibernate Eager Loading Collections + Paging

前端 未结 1 1453
终归单人心
终归单人心 2021-01-13 03:37

Here is an example of my entities that I am trying to return with eager loaded collections.

Mixes -> Tracks (collection) -> Tags (collection)

I need to ret

1条回答
  •  旧巷少年郎
    2021-01-13 04:25

    1. Fetch the Mixes page you want, without any Tracks or Tags.
    2. Fetch all the Tracks (left join Tags) that correspond to the all the Mixes you fetched in the step above (i.e. if you're using HQL, use SetParameterList to pass all the Mixes IDs)

    Total: 2 queries.

    0 讨论(0)
提交回复
热议问题