I digged into the hibernate code and found the problem. It lies in the option allowProxyCreation (DefaultLoadListener.onLoad()).
Using the load method, it seams to make it possible to use a proxy and only access the database if the proxy is accessed. Maybe this is a method of providing additional optimizations (loading more then one proxy but fetch all at once, once any of those proxies is accessed, but I am not sure, didn't digged that far).
At the end, it turns out, that the solution lies in triggering a method path(message chain) to end with the option allowProxyCreation being set to false.
This makes it possible:
Code:
else if ( loadType == GET ) {
options.setAllowNulls(true);
options.setAllowProxyCreation(false);
options.setCheckDeleted(true);
options.setImmediateLoad(false);
}
So all that I should do is using SessionImpl.get(..) instead of SessionImpl.load(..).
I tried it and problem solved... . Sorry for disturbing you.
Cheers,
Martin (Kersten)