All the services of my business tier have the same signature:
In the abstract ancestor of business facades, I have defined a single entry method which is a dispatcher to the appropriate service (ie "myServiceX) :Code:public class myFacade extends BusinessFacade { public void myService1(BusinessRequest req, BusinessReponse resp) throws BusinessException; public void myService2(BusinessRequest req, BusinessReponse resp) throws BusinessException; }
Now, I would like to define the transaction attributes of every concrete service (myService1, myService2) :Code:public abstract class BusinessFacade { public void invokeService(BusinessRequest req, BusinessReponse resp) throws BusinessException { // invoke in concrete class the method named <req.getRequestedService()> - eg "myService1" }
But as the generic method invokeService() is supposed to be THE - only - "normal" way of calling business service (although you could invoke directly myService1), it is always that front method that is first called on the TransactionProxy. Therefore I cannot reasonnably set it to "ReadOnly". The subsequent call/forward to the wanted service (myService1) is done on the concrete facade - no more on the proxy , making so unnecessary my settings for myService1 & myService2...Code:<bean id="..." class="...TransactionProxyFactoryBean"> <property name="transactionAttributes"> <props> <prop key="invokeService">PROPAGATION_REQUIRED</prop> <prop key="myService1">PROPAGATION_REQUIRED</prop> <prop key="myService2">PROPAGATION_REQUIRED,readOnly</prop> </props>
Question:
How could I ensure a read-only transaction for myService2 knowing that myService2 is actually a (so to say) nested service of the non read-only primary invokeService service ?
Thanks in advance,
Bernard.


Reply With Quote