what I need:
Code:
Cat getCatServiceFct() {
Hibernate.initialize(cat.getKitten());
work(cat.getKitten());
Hibernate.uninitialize(cat.getKitten());
return cat;
}
I actually found an old issue for this:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-289unfortuantely it does not have any forum discussion assigned and it's been closed by gavin without detailed information.
however I think that is exactly what I need - let me explain my use case:
In my webapplicatin I have a service method, that reads a list of imageMetaInfo entities and each of them has an association with an imageData object (which holds the images binary data)
after reading the data, the service method will copy the binary data to another object (some resource servlet with a cache).
from this time on, I do NOT need the binary data any longer - so that's the point where I'd like to call
Code:
imageMetaInfo.uninitialize(imageData).
the service method then returns the imageMetaInfos to the client.
the binary data is of course completely useless for the client and we do not want the data to be transferred.
so I think uninitialize() would make sense in this case?
or does anyone know a viable workaround, like imageMetaInfo.setImageData(new HibernateProxy())?