I have this schema:
I have already done ManyToMany mapping between Post
and Tag
. What I'm trying to achieve is get the list of Posts and for each Post its child collection of Tags. So it can be displayed like this:
What I have done so far is this:
IList<Post> results = base._session.CreateCriteria(typeof(Post))
.SetFetchMode("User", FetchMode.Eager)
.SetFetchMode("Votes", FetchMode.Eager)
.AddOrder(Order.Desc("_dateCreated"))
.ToList();
But for every Post
it does 1 extra SQL to fetch Votes
.
Is there a way to fetch it in one go?