]
Emmanuel Bernard resolved HHH-2615.
-----------------------------------
Resolution: Cannot Reproduce
lazy="no-proxy" does what you want
New Lazy option (different meaning than true or extra) - Fetching
when the target entity is demanded and not when something it's done to the proxy.
---------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2615
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2615
Project: Hibernate3
Issue Type: New Feature
Environment: hibernate 3.1.3
jdk 1.4.2_05
DB Oracle9i
Eclipse 3.1.2
Reporter: Albert Ruiz
Priority: Critical
I think it would be a good improvement for hibernate to have a new kind of lazy
configuration (complementing false,true and extra).
I haven't seen noone talking about the possibility to use this approach for lazy
fetching.
The idea would be not to fetch the object when you do 'something' to the proxied
'target' entity (the 'something' action that now provokes the fetch
depends on lazy="true" or "extra"), but to do the fetch when you look
for the 'target' entity. What I mean with this is that, with this option enabled,
when you make a 'load' from the session (loadAll,etc.) you get a proxied object (I
will explain later why to proxy it) that has been fetched (because you have demanded the
object and the new lazy option has been set). When you get an associated entity from this
proxied fetched entity (and that's the reason we proxy it althoght it's been
fetched), the proxy does the same with the target depending on the lazy option configured
for its relation (if the relation uses again the new lazy option, the proxy fetchs the
entity and returns it with the associated proxy which has the same behavior and so on.).
I think this kind of lazy configuration has sense (it doesn't return the complete
database structure as the no-lazy option does, but the target entity is fetched when you
get it).
I've got this idea while i was thinking on how to deal with inheritance and lazy
entities. I understand that all other lazy options imply not knowing which class must the
proxy subclass (because no fetching has been done). If the 'proxy' attribute is
used, the proxy will implement all hierarchy interfaces instead the 'real ones'
(because, again, no fetching is done). On the other hand, if the 'new' lazy option
is used, hibernate can do the fetch and then associate the correct proxy (subclassing the
valid implementation class).
I've been looking around searching all the possible information about lazy options
and I haven't seen anything related to this approach. I don't know if there's
something being done about it or if it has been avoided for some good reason.
I suppose another LazyInitializer and EntityPersister should be implemented (i will try
to do something, but first i would like to know if there's something being done
already or it has not sense to do it).
Thanks in advance for the time.
PS : I apologize for my english; it's not my native language.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: