I forgot to mention I'm using NHibernate 4.1.1.

Any help would be appreciated.

On Nov 26, 5:36 pm, Roni Dover <[email protected]> wrote:
> Hi,
>
> A quick question about lazy loading in Nhibernate following some
> issues we've had.
> Is it possible that enumerating a lazy collection will fetch proxy
> entities from the session if they exist and not retrieve the actual
> data?
>
> I have an hierarchic EntityBase object with a parent-child
> relationship that is lazily loaded which is defined as follows:
>
>     <set name="Children" lazy="true" cascade="all-delete-orphan"
> inverse="true" access="field.pascalcase-m-underscore" optimistic-
> lock="false">
>         <key column="ParentId" />
>         <one-to-many class="EntityBase" />
>       </set>
>
> I have another object called EntityLock which also has a lazy
> reference to EntityBase (well an EntityBase derived class called
> "Resource". I dunno if the inheritance is relevant but I'm mentioning
> it in case it is):
>
> <many-to-one unique="true" not-null="true" name="Resource"
> column="ResourceId" />
>
> So what I'm seeing is that if I load the EntityLock objects first,
> they add proxies of the Resource object to the identity map, then when
> the "Children" lazy collection is iterated these proxy objects are
> fetched instead of real data. This reminds me of lazy=extra in
> hibernate because it creates a situation where after enumerating the
> collection I have to fetch each entity. Whats annoying is that the
> order of loading (whether or not I loaded an EntityLock in the same
> session) affects the behavior and makes it a bit unpredictable.
>
> My question is:
> 1. Is this behavior the right one?
> 2. Can I do anything to tell the collection on the one hand be lazy
> and on the other hand load actual data and not proxies when
> enumerated.
>
> Thanks a bunch in advance,
>
> Roni Dover.

--

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