PDA

View Full Version : Hibernate interceptor



fmourioux
Sep 2nd, 2004, 03:15 PM
Hi,

I'd like to add a log of all the hibernate action in my webapp.

For this i think that an interceptor is better than putting additionnal code.

If someone as an example for this, i'll be happy to read an implementation. ;-)

Thanks,

Fabien.

irbouho
Sep 2nd, 2004, 06:26 PM
For an example of Hibernate Interceptor, take a look at Interceptors (http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html#manipulatingdata-interceptors) of Hibernate Documentation.

To configure a Hibernate Interceptor with a LocalSessionFactoryBean, use the following:


<bean id="myInterceptor" class="com.company.MyInterceptor"/>
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFact oryBean">
<property name="entityInterceptor">
<ref bean="myInterceptor"/>
</property>
</bean>


HTH

fmourioux
Sep 4th, 2004, 04:08 PM
ok that's ok irbouho thanks,

Fabien.