Further to this, if I use HibernateContext.getSession(), I seem to get the same session, resulting in a loop. HibernateContext.getUnmanagedSession() gets a different session, but that too seems to result in far too many calls to post flush (for every insertion that should have a single audit entry, I get ~1600 entries!).
I think that whether I ask for a managed Session or an unmanaged Session, the Interceptor is registered with the returned Session, which results in a large number of calls to the postFlush() method on the interceptor.
Obviously, I need a session without the interceptor - my interceptor is registered in the hibernate-service.xml within the .har file.
Therefore, should I create a second mbean entry in there with the same contents as the first, except that the interceptor isn't declared, and use that mbean from within the interceptor?
Thanks for your help with this.
|