If you have to configure the global interceptor at SessionFactory level, you do it this way
MyInterceptor implements Hibernate's EmptyInterceptor. But this makes the Interceptor global interceptor. So is there a way to define an interceptor as Session scoped. I am using this procedure for my DAOs which implement HibernateDaoSupportCode:<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name = "entityInterceptor" ref="historyInterceptor" /> </bean> <bean id = "historyInterceptor" class="com.example.MyInterceptor" />
But I hate having to do it everytime. Any suggestions would be helpful.Code:getHibernateTemplate().getSessionFactory.openSession(new MyInterceptor());


Reply With Quote