| Hi,
 I have a schema which, very simplified, is something like:
 
 Forum ----<- Post
 
 (There can be more than one forum)
 
 The Forum class has a PostCount int on it so we don't have to get the entire collection of posts. We're currently using a formula to get the post count. Nice and simple.
 
 However, we sometimes get a collection of Forums. Before using NHibernate, we had one big ugly query to work out the PostCount for each forum. We are now doing 1+N queries (where N is the collection size) to get the same data.
 
 Is there a prefered way of doing this. Not worry about the performance hit, or denormalize the data (so when a post is added the postcount is incremented etc.)? Neither seem optimal.
 
 Any ideas would be appreciated.
 
 Nick H
 
 
 |