For those who are interested, here's how I did it
Code:
<bean id="baseRemoteServiceProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributes">
<props>
<prop key="persist*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="harvest*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
<property name="preInterceptors">
<list>
<ref bean="remoteExceptionInterceptor"/>
</list>
</property>
<property name="postInterceptors">
<list>
<ref bean="entityAfterAdvice"/>
<ref bean="clientToServerAdvice"/>
</list>
</property>
</bean>
As you can see the exception interceptor is called last, which means it can also intercepts the exceptions related to the transaction commit. The two other advices that must run in a transaction are set in the post interceptors so that the transaction is available to them there. With this base proxy I just have to create the actualy remote proxy with this simple definition
Code:
<bean id="remoteCatalogServiceProxy" parent="baseRemoteServiceProxy">
<property name="proxyInterfaces" value="com.foo.remote.RemoteCatalogService"/>
<property name="target">
<bean class="com.foo.service.catalog.RemoteCatalogServiceImpl">
<constructor-arg ref="catalogService"/>
<constructor-arg ref="entityFactory"/>
</bean>
</property>
</bean>
I would prefer to use AOP, trust me, but activating it on my config lead to too many issues.
And now I have another issue, nice.
Code:
org.springframework.transaction.IllegalTransactionStateException : Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access.
If only have a transaction manager of course. Does spring support a mix of transactionfactory bean and @Transactional?