Yeah, I see that. I should probably mention I am using Spring to get a new Session. It has an overloaded method to get a new Session as follows:
Code:
Session session = SessionFactoryUtils.getSession(getSessionFactory, true);
The true parameter forces a new session to be created. Considering that this seems to be the same as the example, I was wondering if you saw this behavior in the Hibernate version or was this just some code you whipped up to show the concept.
The only way I could prevent from going into an infinite loop is to have a separate sessionfactory that doesn't use my audit Log entityInterceptor. Weird huh? But that's something I can take up with the Spring guys.
Also, it looks like there's an error in the code on pp. 345. : setSession() and setUserId() aren't available on the "Interceptor" interface, so the initialization would have to be:
Code:
AuditLogInterceptor interceptor = new AuditLogInterceptor();
Lou