I was trying to explain why you see them being fetched one by one.This is usually an indication that the actual set elements are not cachble.
On Mon, Mar 23, 2009 at 10:07 AM, Carsten Hess <[email protected]>wrote: > > Ayende - I'm not using a HQL to load the collection - the collection > is a non-lazy set of an entity . So there's no where to set the > "SetCachable(true)" - (which I'am already using with success on some > HQL queries). > > The problem is also not only that its not being cached, but that the > elements of the collection are fetched one by one instead of loading > them in one go using the id of their parent entity (which it does when > I disable caching on the set) > > Kind regards > Carsten > > On Mar 23, 2:40 pm, Ayende Rahien <[email protected]> wrote: > > http://ayende.com/Blog/archive/2006/08/21/TheSecretLifeOfNHibernatesC... > > > > On Mon, Mar 23, 2009 at 8:45 AM, Carsten Hess <[email protected] > >wrote: > > > > > > > > > > > > > Hello there. > > > > > Using trunk. > > > > > I'm seeing a strange behaviour on a set mapping. > > > > > I used to have a mapping like this: > > > > > <class A > > > <cache usage="read-only"/> > > > <set B> > > > <one-to-many class="X"/> > > > </set> > > > </class> > > > > > My entity A is perfectly cached and retrieved from 2. level cache > > > (seen via NHProf) and the set of X's (150 elements) is fetched in one > > > go afterwards. > > > > > Now to the strange behaviour: > > > I found out that its possible to cache a set as well and therefore > > > added this to the mapping: > > > > > <class A > > > <cache usage="read-only"/> > > > <set B> > > > <cache usage="read-only"/> <--- > > > caching of the set > > > <one-to-many class="X"/> > > > </set> > > > </class> > > > > > Now 150 elements of the set are loaded in a N+1 fashion one by one via > > > their id !!! (and they are not cached) > > > > > Is this a bug or am I missing something ?? > > > > > Kind regards > > > Carsten > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
