Hello.
I'm trying to set up two different Entity Interceptors for hibernate using the LocalSessionFactoryBean. It seems that the LocalSessionFactoryBean only allows for one interceptor. Can I use the ProxyFactoryBean to add more? I currently have the following setup:
<bean id="catalogDS" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiTemplate">
<ref bean="wlJndiTemplate"/>
</property>
<property name="jndiName">
<value>${jndi.appname}/Catalog</value>
</property>
</bean>
<bean id="CatalogTransactionManager" class="org.springframework.orm.hibernate.Hibernate TransactionManager">
<property name="sessionFactory">
<ref local="com.stormhq.entity.CatalogSessionFactory"/>
</property>
</bean>
<!-- my own hibernate interceptor for dirty entity detection -->
<bean id="unsavedBeanInterceptor" class="com.stormhq.util.HibernateUnsavedEntityInte rceptor"/>
<bean id="com.stormhq.entity.CatalogSessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
<property name="dataSource">
<ref bean="catalogDS"/>
</property>
<property name="entityInterceptor"><ref bean="unsavedBeanInterceptor"/></property>
<property name="mappingResources">
<list>
<value>com/stormhq/entity/Category.hbm.xml</value>
<value>com/stormhq/entity/ProductGroup.hbm.xml</value>
<value>com/stormhq/entity/ProductSKUImpl.hbm.xml</value>
<value>com/stormhq/entity/attributes/Attribute.hbm.xml</value>
<value>com/stormhq/entity/attributes/AttributeGroup.hbm.xml</value>
<value>com/stormhq/lookups/LookupTableImpl.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.O racle9Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<!-- <property name="schemaUpdate"><value>true</value></property> -->
</bean>
<bean id="com.stormhq.entity.dao.CategoryDao" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="target"><ref local="com.stormhq.entity.dao.CategoryDAOImpl"/></property>
<property name="transactionManager"><ref local="CatalogTransactionManager"/></property>
<property name="transactionAttributes">
<props>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="load*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
Thank you.


Reply With Quote