You best bet it to cache the entire thing.
That is, cache the query, the entities and the associations.

Not sure if this is a good idea, though

On Wed, Jan 7, 2009 at 2:53 AM, gatapia <[email protected]> wrote:

>
> Just read: http://www.nhforge.org/doc/nh/en/index.html - 16.4. The
> Query Cache
> Quote: 'Note that the query cache does not cache the state of any
> entities in the result set; it caches only identifier values and
> results of value type'.
>
> I guess this means that EagerFetching in cached queries is not
> supported.
>
> I guess the best bet is not to cache this query.
>
> Thanks anyway.
>
> Guido
>
> On Jan 7, 11:47 am, gatapia <[email protected]> wrote:
> > Hi All,
> >
> > I've run into an issue with EagerFetching and Query Cache.  Basically
> > when a query is run with EagerFetching after the same query has been
> > cached then EagerFetching is ignored.  Eg:
> >
> > // Ensure query cache is enabled
> > ICriteria c = ...;
> > c.SetFetchMode("Children", FetchMode.Eager);
> > c.SetResultTransformer(CriteriaUtil.DistinctRootEntity);
> > c.List<Parent>();
> > Assert.IsTrue(NHibernateUtil.IsInitiazed(c.First().Children));
> >
> > EndNHSession(); StartNHSession();
> > // Same code as above..
> > ICriteria c = ...;
> > c.SetFetchMode("Children", FetchMode.Eager);
> > c.SetResultTransformer(CriteriaUtil.DistinctRootEntity);
> > c.List<Parent>();
> > Assert.IsTrue(NHibernateUtil.IsInitiazed(c.First().Children)); //
> > FAILS!!!!
> >
> > -------------------------
> >
> > Any help would be greatly appreciated.
> >
> > Thanks
> >
> > Guido Tapia
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to