christian wrote:
I'd like to see good use cases for it, so far we haven't seen much. If you have some... I fear it won't work without bytecode instrumentation. Be happy that Hibernate doesn't need it for all other features. ;)
For sure, don't get me wrong. Even as it is I think it is a very usefull
feature.
I am very glad that Hibernate doesn't need it ( bytecode enhancement )
for all it's features.
---------------------------------------------------------------------------------
I can give you a popular use case though for this field level lazy loading
feature.
( all my use cases are on the same theme ( real estate ))
An object which represents a house ( lets call it Property )
holds a collection for it's associated images
(pictures of the front , back, living room etc etc )
You could store this wrapped in an object
lets call it PropertyImage
PropertyImage has the following fields
id Integer
description String
imageData binary [] ( this could be up to 50k in size )
Now it might be desirable to grap the Property object ,
call it's getPropertyImages method which returns the
Set of PropertyImages and then itterate through it.
However the user might not want to look at all the
images, he/she might only look at the descriptions
and then select the particular one that they are
interested in.
So if there are 10 images @ 50k each that is 500k
just for the images.
That is a lot of data to pull into memory.
Obviously if the imageData field was lazy then your
graph would drop dramatically in size.
I have to say that I was delighted when you announced
this feature. I think it is going to be a lot more popular
than you seem to expect.
--b