Hibernate version:
2.1.6
I understand that it is not possible to lazily load the optional end of a one-to-one (-or zero) association:
http://www.hibernate.org/162.html
especially the last paragraph:
Quote:
f your B->C mapping is mandatory (constrainted=true), Hibernate will use proxy for C resulting in lazy initialization. But if you allow B without C, Hibernate just HAS TO check presence of C at the moment it loads B. But a SELECT to check presence is just inefficient because the same SELECT may not just check presence, but load entire object. So lazy loading goes away.
Given this - is there a best practice for mapping this kind of relationship so that the optional child is not loaded when the parent is loaded? This seems to be a pretty common scenario (a small frequently accessed table with an optional primary key relationship to a much larger rarely accessed table) so I wonder how people are addressing it.
Thanks.
Grainne.