From the article above:
Quote:
Right after loading B, you may call getCee() to obtain C. But look, getCee() is a method of YOUR class and Hibernate has no control over it. Hibernate does not know when someone is going to call getCee(). That means Hibernate must put an appropriate value into "cee" property at the moment it loads B from database.
I'm confused here. I thought in NHibernate at least, the proxy for B
does know when the setter for Cee is called, because the property must be virtual in your entity class and the proxy overrides it. So, why can't the proxy's override for the Cee property setter attempt to load the value from the database on first access? That way, time won't be wasted on rarely-touched, non-mandatory one-to-one properties.
I seem to remember the answer to a similar question about "why cant a proxy getter/setter initialize something as needed" was "the proxies are generic from Castle, they don't know anything about NHibernate in particular". If that's the case, that's really too bad ...