Please ignore my last post. I dug into the code some more and what I
mentioned is completely irrelevant.
The reason why initializing a lazy collection returns proxies if
they're in the identity map is much more rooted than I thought and
possibly much harder to change.
I'm still investigating though....


On Dec 31, 11:50 am, Roni Dover <[email protected]> wrote:
> Ok, seemed to have nailed it down, here's what I discovered.
> I'm not even sure if its a problem or not this is what I would really
> like your feedback about...
>
> So this issue of proxies showing at random in collections kept
> resurfacing, I started debugging the Nhibernate sources to find why it
> was happening.
> Here's what I'm seeing:
>
> NHibernate.Loader.Loader has a LoadCollection method which calls the
> DoQueryAndInitializeNonLazyCollections method.
> However, it is *always* passing true for the "returnProxies"
> parameter.
> Eventually, this "true" value makes its way to the GetRowFromResultSet
> method in the same class, which uses entities from the Session
> persistence context if returnProxies is set to true (which it always
> is in this scenario).
>
> If all the members of this collection have been loaded to the session
> via other lazy references this could mean a select(n+1), the issues
> that kept bugging me was that these proxies kept throwing cast
> exceptions as I was expecting them to be initialize when the
> collection is iterated.
>
> So this is the implemented behavior - my question is:
> 1. Is it the right one?
> 2. Assuming I want to make the boolean parameter for returnProxies
> configurable somehow, how would you suggest doing it?
>
> Many thanks in advance,
>
> Roni.
>
> On Nov 30, 9:33 am, Roni Dover <[email protected]> wrote:
>
>
>
> > :) Sorry all the version of the applications are mixing up...
> > Its 2.1 of course.
>
> > Can you give me a direction on this though? I'm trying to understand
> > if its a problem or not.
>
> > On Nov 30, 4:50 am, Fabio Maulo <[email protected]> wrote:
>
> > > 2009/11/29 Roni Dover <[email protected]>
>
> > > > I forgot to mention I'm using NHibernate 4.1.1.
>
> > > Let me know where I can download it. I still working on NH3.0
> > > Thanks.
> > > --
> > > Fabio Maulo

--

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