Hibernate version: ?
In Hibernate 3.x, default behaviour is now to instanciate proxy for one-to-one relationship. You can make hibernate not use proxy using lazy=false at the class or association levels.
When you do parent.getChild().getAPropertyValue() where getAPropertyValue is one of the existing getter, Hibernate will load the related instance.
Quote:
The optional proxy attribute enables lazy initialization of persistent instances of the class. Hibernate will initially return CGLIB proxies which implement the named interface. The actual persistent object will be loaded when a method of the proxy is invoked. See "Proxies for Lazy Initialization" below.
Quote:
By default, Hibernate3 uses lazy select fetching for collections and lazy proxy fetching for single-valued associations. These defaults make sense for almost all associations in almost all applications.
...
Alternatively, we could use a non-lazy collection or association, by specifying lazy="false" for the association mapping. However, it is intended that lazy initialization be used for almost all collections and associations. If you define too many non-lazy associations in your object model, Hibernate will end up needing to fetch the entire database into memory in every transaction!
http://www.hibernate.org/hib_docs/v3/re ... ching-lazy