The real question is, if it would be possible to enable lazy loading for not-found="ignore"? And if so, how much work would it be?
We have to find ways arround these problems in our current project. Altering the NH-code could be one of them, if it is the easiest solution. We can get arround property-ref by changing the mapping. - Lars On 31 Okt., 14:31, Fabio Maulo <[email protected]> wrote: > which part ? the description or the solution of each ? > the desc. is right some solution is wrong. > > 2009/10/30 lars corneliussen <[email protected]> > > > > > > > hi, > > > the original problem was, that lazy loading didn't work. Instead for > > each object found, all associations where load eagerly. > > > After quite some more research, I found the answers. Answers, because > > there are many things that prevented lazy loading in NHibernate. > > > 1. Query vs. session.Load: When fetching an item via session.Load() > > you get a proxy. But as soon as you access any property, lets say the > > Url, the object is fetched including all it's associations that > > doesn't support lazy loading. > > > 2. property-ref: Lazy loading only works over a objects id. When an > > property-association is resolved via a different column in the target > > entity, NH fetches it eagerly. Not that this wouldn't be possible, > > it's just not implemented: > >http://nhjira.koah.net/secure/CreateIssue!default.jspa > > > 3. not-found="ignore" allows invalid foreign keys, that is, if the > > referenced entity isn't found NH will init the property with null. NH > > doesn't intercept the property-access for lazy loading, but instead > > assignes a object proxy. With not-found="ignore" it can't decide if > > the property should be set to null or a proxy for the given, possibly > > invalid, foreign key. This could possibly be solved by intercepting > > the property access. > > > 4. When disabling not-found="ignore" and property-ref the schema > > export would generate constraints that enforce a circular reference. > > Not good! The correct mapping would then be a constrained one-to-one > > relationship, where the key for HippoAccountSync must have a generator > > foreign. > > > Are these points right? > > > Could NH support lazy-loading for not-found="ignore" and property-ref > > at some point, or is it impossible? > > > thanks! > > - Lars > > > On 29 Okt., 22:54, Fabio Maulo <[email protected]> wrote: > > > I never seen his mapping.... > > > > I can jump in another place to see an answer but not to read a question > > nor > > > how recreate an issue. > > > > 2009/10/29 Diego Mijelshon <[email protected]> > > > > > You're correct... that's the long answer :-) > > > > > But unless you specify that, the answer to "shouldn't each entity in a > > > > list, when queried via the criteria API, be a proxy" is no, as that's > > not > > > > the default behavior, nor the expected behavior with his mapping and > > query. > > > > > Diego > > > > > PD: quedó largo el disclaimer, pero vos me entendés :-) > > > > > On Thu, Oct 29, 2009 at 13:39, Fabio Maulo <[email protected]> > > wrote: > > > > >> lazy=extra and some specific indexed collection (for example <map> > > > >> IDictionary). > > > > >> 2009/10/29 Diego Mijelshon <[email protected]> > > > > >> Short answer: no. > > > > >>> Diego > > > > >>> On Thu, Oct 29, 2009 at 11:22, lcorneliussen <[email protected] > > >wrote: > > > > >>>> Hi all together! > > > > >>>> I'm sure I am missing something, but shouldn't each entity in a > > list, > > > >>>> when queried via the criteria API, be a proxy that enables lazy > > > >>>> loading? > > > > >>>> I posted my question on stack overflow. The code is more readable > > over > > > >>>> there: > > >http://stackoverflow.com/questions/1643905/nhibernate-creates-proxy-v... > > > > >>>> Any hints appreciated. > > > > >>>> - Lars > > > > >> -- > > > >> Fabio Maulo > > > > -- > > > Fabio Maulo > > -- > 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 -~----------~----~----~----~------~----~------~--~---
