Hibernate version: cvs_snapshot
Hi there,
i've had a look at the hibernate source concerning the handling of lazy-loading and proxies ... i haven't spent much time for it, but i think i have a low understanding how it works ...
Am i right, that the LazyInitializer will load the 'missing' entity in his 'initialize'-method and puts the result in the 'target'-variable?
For me, that would be a great point to do the following:
- add my own implementation (possible way is to configure what to use in the hbm.xml-file)
- don't use the Hibernate-Session directly, but use the same 'persistence-services' as i would use without a proxy (eg. if i want to load a person with id xy). Then there would be no need of 'ad-hoc' transaction- and session-handling in the proxy instead it would be the same as during 'normal' application-flow.
Eg. i wouldn't call "session.immediateLoad" but "persistenceManager.immediateLoad(..)" .. sure not such a big difference but if it would be then possible to add the parent of the lazy-loaded entity, i could open a new session, reattach the parent etc. ...
It also would be possible to use lazy-loading in distributed environments ... (depends on the implementation of the proxy)
Sure, my thoughts are at the beginning, and there're some points which propably won't really be easy ... but i like the idea ...
So my question is, if such a possibility to add my own Proxy-code is planed? Wanted? Expedient? Like written above the difference between my thoughts and the current implementation is not really big, but i think my thoughts are more fexible ...
Or is this approach completly nonsense? And if ... why?
thx!
curio
|