I did some more research on this matter by stepping through NHibernate
source, but it's hard for me to grasp its logic for the no-proxy case.
But I did get some results - I added a couple of "Debug.WriteLine"s in
the code and turned on show_sql in the config, and this is the log I
got:

WireTransfer ctor accessed.
Order.Payment.set accessed.
Order.Payment.get accessed.
Order.Payment.get accessed.
-- session.Get<Order>(1) starts (this is the important part) ----
13:56:01,212 INFO  EntityMetamodel:0 - Ghost property fetching
available for: NHibernate.Test.GhostProperty.Order
13:56:01,281 ERROR EntityMetamodel:0 - Lazy or ghost property
NHibernate.Test.GhostProperty.Order.Payment is not an auto property,
which may result in uninitialized property access
NHibernate: SELECT order0_.Id as Id0_0_, order0_.Payment as
Payment0_0_ FROM Orders order0_ WHERE order0_....@p0;@p0 = 1 [Type:
Int32 (0)]
NHibernate: SELECT payment0_.Id as Id1_0_, payment0_.Type as Type1_0_
FROM Payment payment0_ WHERE payment0_....@p0;@p0 = 1 [Type: Int32
(0)]
WireTransfer ctor accessed.
Order.Payment.set accessed.
-- session.Get<Order>(1) finished ---
NHibernate: select order0_.Id as Id0_, order0_.Payment as Payment0_
from Orders order0_
WireTransfer ctor accessed.
Order.Payment.set accessed.
NHibernate: select payment0_.Id as Id1_, payment0_.Type as Type1_ from
Payment payment0_
NHibernate: select order0_.Id as Id0_, order0_.Payment as Payment0_
from Orders order0_
NHibernate: select payment0_.Id as Id1_, payment0_.Type as Type1_ from
Payment payment0_

This shows that the WireTransfer object was created during the loading
of order - session.Get<Order>, but more importantly it shows that an
sql SELECT command really did load the Payment record, so it wasn't a
proxy or empty object of some kind... This looks like a bug to me, can
someone confirm - or give me a hint for further investigation?

Thanks!

BTW, the error in the log about the auto property doesn't seem to
influence this - I tried changing the property but it still behaves
the same.

-- 
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