All entries for Thursday 11 August 2005
August 11, 2005
Writing about web page http://twasink.net/blog/archives/2005/04/upgrading_to_hi_1.html
So whilst struggling with the wonder that is CGLIB and hibernate proxies and lazy loading, I stumbled across link which is a very useful link.
In summary, hibernate 3 makes everything lazy including classes. This means that unless you explictly define a proxy element you will get a CGLIB class. Unfortunately CGLIB won't work if your class or any methods are final. Since lazy loading of classes isn't really that useful, turning off lazy loading would seem a sensible option. Unfortunately this means that all single point associates (one-to-one, many-to-one) are eagerly loaded, regardless of how they themselves are defined :)
As a matter of course, I always define an interface which my domain objects implement, and thus use proxies.