When
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.
If you want an object to be really loaded when you first access a method of it , use proxy.
Code:
myObject = session.load(...);
myObject.getValue();
The object will be loaded when getValue is accessed (not 100% sure of it, but should be true).
I've never used it in real life but with collection. Lazy loading of collection is enabled by
Code:
lazy="true"
in collection mapping. No need for proxy parameter.
HowQuote:
You may specify the name of the class itself.
is the easiest way. Your class should not be final.
For collection add
Code:
lazy="true"
in collection mapping.
To sumarize, don't bother with proxy parameter.