This is a general question. We're using Hibernate 2.1.6. We're using an Interceptor to do logging and want to keep track of the values in a deleted object as they were at the time of deletion.
The values in the object can include some lazily initialized collections. We understand that it is illegal to initialize a collection from within the Interceptor. It's easy enough to check to see if these values are initialized, but it's unclear what to do if a collection is not already initialized.
We tried loading the entity from another Session object that we have on the same connection. Unfortunately, though the entity loaded from the Interceptor's local session was a different object, the collections within the local entity were references to the same collections in the original entity. So, accessing one of these collections is the same as initializing the original entity's collection.
Is there any way to do this?
Thanks,
Kealy & Kevin
|