Ok, some background info first. I'm currently implementing a set of interceptors to handle field-level audit for persistent objects. There is an interceptor for onLoad, which stores object's initial state, and interceptors for onSave, onFlushDirty, and onDelete, which compare object's new state with the initial one, and construct audit trail based on the differences.
The problem I've encountered is that this setup doesn't quite work with the Open Session in View pattern. Since lazy-loaded properties are not yet loaded during the onLoad event, their inital state cannot be captured, and no proper audit trail could be constructed.
The workaround for collection-based lazy properties was simple - there's an event called InitializeCollectionEvent, which fires at the time collection is loaded, allowing me to capture its initial state at that time. However, this event is not fired for any property that is not a collection - like a lazy-loaded BLOB, or formula column, etc.
So, my question is, then - is there a way to intercept the event of loading a non-collection lazy property?
Thanks in advance,
Alex
|