When using a BeanNameAutoProxyCreator with Hibernate DAO classes, spring 1.1.5 fails to catch net.sf.hibernate.StaleObjectStateExceptions and convert them to DataAccessExceptions.
When I do not use the auto proxy, I can catch and deal with hibernate exceptions, but when the proxy is in place, the exceptions are magically thrown, and there's nothing I can do about it.
Is this by design? If so, how can I use the auto proxy features in spring and still handle optimistic locking failures?
Thanks,
Josh
[/code]Code:<bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="interceptorNames"> <list> <idref bean="matchNameTxInterceptor" /> </list> </property> <property name="beanNames"> <list> <value>org_sakaiproject_service_gradebook_GradebookService</value> <value>org_sakaiproject_tool_gradebook_business_GradebookManager</value> <value>org_sakaiproject_tool_gradebook_business_GradeManager</value> </list> </property> </bean> <bean id="matchNameTxInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager"> <ref bean="gradebookTransactionManager" /> </property> <property name="transactionAttributeSource"> <ref bean="matchNameWithPropReq" /> </property> </bean> <bean id="matchNameWithPropReq" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource"> <property name="properties"> <props> <prop key="add*">PROPAGATION_REQUIRED</prop> <prop key="create*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="remove*">PROPAGATION_REQUIRED</prop> <prop key="*">PROPAGATION_REQUIRED,readOnly</prop> </props> </property> </bean>


Reply With Quote