Hello, I have a situation where I have a UUID for an entity and am using the session.byId(MyClass.class).getReference(id) to get a reference to it (to use to populate a foreign key relationship). If I turn on my database trace I see that a query is emitted to do the query during the call to getReference. Strangely, if I step through the call stack. Then I get to line 149 in JavassistLazyInitializer#getProxy:
Code:
( ( ProxyObject ) proxy ).setHandler( instance );
instance.constructed = true;
return proxy;
the call to setHandler completes and I'm at a breakpoint before setting instance.constructed. At this point in time -- no calls to the database have been made and from what I can tell of this code path, Hibernate is trying to return a proxy as I want it to! Once I step over the instance.constructed = true that's when hibernate intiailizes the proxy calling the database and executing my select query! Is javassist catching the field store to constructed and executing the initialization logic?!
Anyone have any experience with this or ideas?