I am trying to efficiently work with parent & child (post & tags) entities. A sample of the code can be seen here: http://gist.github.com/297464
Using the following results in less than 10 distinct Post entities if any of Post contains more than 1 tag.
var posts = session
.CreateCriteria<Post>()
.SetMaxResults(10)
.SetFetchMode("Tags", FetchMode.Eager)
.List<Post>();
If I remove the .SetFetchMode line above, I get the 10 records I am looking for, but all of the Tag entities are queried and then filtered in memory.
It seems like I should be able to instruct NHiberate to either pass in a list of PostIds or do a join.
I am pretty new to NHiberate so it is also entirely possible I am going at this completely wrong.
Thanks,
Scott