<p>Cool!</p>
<p>I didn't know about DistinctRootEntityResultTransformer()</p>
<p>Great post!</p>
Just a minor point to note here.
Using Result Transformer with query cache has to be very careful. Executing 2 identical queries with different result transformer *instances* makes Query Cache not working (as I expected).
IQuery query1 = IQuery.GetCacheEnabledQuery().SetResultTransformer(new DistinctRootEntityResultTransformer()).List();
IQuery query2 = IQuery.GetCacheEnabledQuery().SetResultTransformer(new DistinctRootEntityResultTransformer()).List();
query2 can't use the cache from query1 just because the result transofrmer *instances* are different.
IQuery query3 = IQuery.GetCacheEnabledQuery().SetResultTransformer(CriteriaSpecification.DistinctRootEntity).List();
IQuery query4 = IQuery.GetCacheEnabledQuery().SetResultTransformer(CriteriaSpecification.DistinctRootEntity).List();
query4 will get the result from the cache resulted in query3.
Any idea how one can handle this case with nested objects with join queries where its not the root entity being affected?
e.g.
Person.Business.Addresses where there are 1+ addresses, I get back dups on the Business.
Any help would be gr8.
Thanks
Sorry, forgot to add....the case of loading is through the Person (and lazy loading turned off)