I have done some test now. Yeah, it "does" load the reference if you set lazy="no-proxy" although the article says otherwise!!
*Mohamed Meligy *Readify | Senior Developer M:+61 451 835006 | W: readify.net [image: Description: Description: Description: Description: rss_16]<http://gurustop.net> [image: Description: Description: Description: Description: cid:[email protected]] <http://www.linkedin.com/in/meligy> [image: Description: Description: Description: Description: cid:[email protected]] <http://twitter.com/meligy> <http://www.greatplacetowork.com.au/best/best-companies-australia.php><http://www.readify.net/AboutUs/NewsItem.aspx?id=10> On Sat, May 21, 2011 at 3:27 AM, <[email protected]> wrote: > If I use "no-proxy" it should (and is) always be initialized, but it should > not be loaded immedetialy from the DB (i think). > This is not a real issue for me right now, since what i wanted can be > accomplished using lazy="proxy", but i 'm really interested > in what the problem here is or what i'm doing wrong. > > > Am schrieb "H.Alex" <[email protected]>: > > > you can try testing with > > > > > > > > NHibernateUtil.IsInitialized(laizy property); > > > > > > > > > > > > On May 20, 12:12 pm, [email protected] wrote: > > > > > I don't think so beacuse in the first case ("proxy") => one query is > > > > > executed > > > > > in the second case ("no-proxy") => two queries are executed immediately > > > > > > > > > > In the first case, the second query (for the Script property) is only > > > > > executed, if i use the VS watch window > > > > > or something. This is the expected behaviour. But i thought this should > be > > > > > the same if i use "no-proxy" > > > > > > > > > > Am schrieb Mohamed Meligy [email protected]>: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The query for the Script is then executed if i look at the property > in > > > > > > the VS watch window. > > > > > > Maybe this is the reason? To get the property value, even in Visual > > > > > > Studio watch window, the property getter is executed. > > > > > > Mohamed Meligy > > > > > > Readify | Senior Developer > > > > > > M:+61 451 835006 | W: readify.net > > > > > > On Fri, May 20, 2011 at 7:34 PM, [email protected]> wrote: > > > > > > @mohamed > > > > > > to test this, i simply do > > > > > > Marker pTM = Session.Get(10824); > > > > > > and then check the sql output to the console. Using "proxy" only one > > > > > > > query is executed: > > > > > > NHibernate: SELECT marker0_.MARKER_ID as REPORTS1_282_2_... > > > > > > The query for the Script is then executed if i look at the property > in > > > > > > the VS watch window. > > > > > > Using "no-proxy" the call to Get shows two executed queries, one for > the > > > > > > Marker itself and the second for the Script: > > > > > > NHibernate: SELECT marker0_.MARKER_ID as REPORTS1_282_2_... > > > > > > NHibernate: SELECT script0_.SCRIPT_ID as T1_264_3_, script0_.SC_DESCR > ... > > > > > > One guess was that the ID is the problem since this is a property and > it > > > > > > will be touched to create the temp > > > > > > instance. So i changed it to access="field.pascalcase-m-underscore" > but > > > > > > it did'nt solve the problem. > > > > > > Am schrieb Mohamed Meligy [email protected]>: > > > > > > > Ramon, this is not eager loading. > > > > > > > > > > > > Quoting from the mentioned post: > > > > > > > > > > > > When lazy is set to no-proxy, the following things happen:The > > > > > > association is still lazy loaded (note that in older versions of > > > > > > NHibernate, setting it to no-proxy would trigger eager loading, this > is > > > > > > no longer the case). > > > > > > > > > > > > The first time that you access the property the value will be > loaded > > > > > > from the database, and the actual type will be returned. > > > > > > > > > > > > @belvasis, > > > > > > > How are checking this? Note that maybe even looking up the value in > > > > > > > debugger or Visual Studio Watch window triggers this. Are you sure > your > > > > > > code is not touching the property in any way? > > > > > > > > > > > > Can you isolate it and paste it in a letter message? > > > > > > > > > > > > Thanks a lot. > > > > > > > > > > > > Regards, > > > > > > > > > > > > Mohamed Meligy > > > > > > > Readify | Senior Developer > > > > > > > > > > > > M:+61 451 835006 | W: readify.net > > > > > > > > > > > > On Fri, May 20, 2011 at 5:08 PM, Ramon Smits [email protected]> > > > > > > > wrote: > > > > > > > > > > > > Hm i think i understand this. But shouldn't the behaviour be the > same? > > > > > > Why "no-proxy" immediately queries > > > > > > > > > > > > to the database? > > > > > > > > > > > > As a proxy makes it possible to have delayed loading? > > > > > > > > > > > > -- > > > > > > > > > > > > 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. > > > > > > > > > > > > -- > > > > > > > > > > > > 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. > > > > > > > > > > > -- > > > > > > 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. > > > > > > -- > > > > > > 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. > > > > > > > > -- > > > > 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. > > > > > > > > > > -- > 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. > -- 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.
