Of course it is not a bug in Hibernate. For anyone who runs into this in the future -- it is due to the class lazy loading becoming the default in Hibernate 3.x - I didn't have some required dependencies (org.objectweb.asm) for CGLIB. I had also disabled even error logging for hibernate while running my unit tests. Once I enabled logging (org.hibernate.tuple), I saw the obvious problem:
Code:
Caused by: java.lang.NoClassDefFoundError
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at org.hibernate.proxy.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:116)
... 25 more
This causes buildProxyFactory in PojoEntityTuplizer to return null, thus the later getProxyFactory call when we are actually getting the proxy for the class fails with an NPE.
While the NPE isn't pretty, IMHO I don't think it's really a bug because the behavior of the class has to be undefined if there is an unexpected failure.
I think I will file an enhancement request that -if- there is an error in setting up the CGLIB stuff (proxy factory is unavailable) the class lazy loading behavior will flip back to lazy="false". That seems like a reasonable solution - anyone have an opinion to the contrary?