[jboss-user] [JBoss Seam] - Re: Audit Interceptor with State

JakeC do-not-reply at jboss.com
Fri Oct 12 15:08:41 EDT 2007


I am trying to create an Audit record using Hibernate Interceptors, but I'm having trouble figuring out how to configure it within Seam.

In order to get the userId into the Audit record, I need to create a new Interceptor per Session, passing in the userId via the Interceptor's constructor. According to Hibernate, the way to do this is to use SessionFactory.openSession(Interceptor interceptor). The only place in Seam where SessionFactory.openSession() is in com.jboss.seam.core.ManagedHibernateSession, but it doesn't pass in any parameters at all.

Furthermore, ManagedHibernateSession only seems to come into play if your project declares your DB in components.xml as a simple class (see examples\hibernate\resources\WEB-INF\components.xml), whereas we are using core:managed-persistence-context to declare an EntityManager.

So, how do I get a Hibernate Interceptor (that requires a userId in the constructor) configured within Seam? OR, is it possible to configure the class WITHOUT passing userId in the constructor, but having the userId INJECTED into the Hibernate Interceptor?

UserID is key. It just isn't a REAL Audit without knowing WHO.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094750#4094750

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094750



More information about the jboss-user mailing list