Hi,
Q: Is it possible to get entityName of a current object passed to an interceptor in a callback handler (onSave or onFlushDirty)?
I saw getEntityName() in the Interceptor interface, but I don't know how would I implemented that in my interceptor.
In my application I use interptor to save copy of created/modified objects to another table (historical data) using entityName property. I would like to check entityName to know if it is original object or already its copy.
I walked about this problem using another (temporary) session in callback with empty interceptor (SessionFactory.openSession(connection, new MyEmptyInterceptor())), but maybe it can be done in a "normal" way?
Btw, I saw in hibernate code that there is no problem with that in the Events mechanism (and probably I will use it), but I wonder how it is in the Interceptors.
Hibernate version: 3.1.2
Marcin
|