In the hibernate documentation is explained that it is not allowed to use the original hibernate session within an interceptor callback.
This means that i should have access to the Sessionfactory within my Interceptor.
The problem is that the interceptor is a property of the Sessionfactory in the ApplicationContext.
How can i provide the SessionFactory to the Interceptor? Or is there another way to create a temporary session based on the current connection?
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
<property name="dataSource"><ref bean="dataSource"/></property>
<property name="mappingResources">
<list>
<value>org/appfuse/model/Person.hbm.xml</value>
</list>
</property>
<property name="entityInterceptor">
<ref local="myHibernateInterceptor"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">@HIBERNATE-DIALECT@</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="myHibernateInterceptor" class="org.appfuse.MyInterceptor">
</bean>
Regards,
Rene Boere


Reply With Quote