Spring transaction management for execution service methods from same service -


for example have bean service has 2 methods , 1 of them (testa) execute 1 (testb).

public class testserviceimpl implements testservice { ... public void testa() throws exception {     ...          try {         this.testb();     catch(exception e)     {         ...     }     ... } public void testb() throws exception {     ... } 

}

method testb defined propagation_requires_new transaction attribute, method testa defined propagation_required.

<bean id="testservice" class="org.springframework.transaction.interceptor.transactionproxyfactorybean">     <property name="target" ref="testservicetarget"/>     <property name="transactionmanager" ref="transactionmanager"/>     <property name="transactionattributes">         <props>                          <prop key="testb*">propagation_requires_new, isolation_read_committed, -exception</prop>             <prop key="*">propagation_required, isolation_read_committed, -exception</prop>         </props>     </property> </bean> 

then execute testa method of service. in logs can see method testa new transaction created, ok. when testb method executed methoda, in logs have information actual transaction being used instead of suspending actual , creating 1 (like defined in configuration).

so normal behaviour in spring when execute service method in other method of same service, spring omit transactional configuration method (like in example method testb) , use propagation_required attribute?

additionally let's when method testb other service , configuration method same (propagation_requires_new) seems tobe fine (new transation created, actual suspended).

as transaction manager used webspheretransactionmanagerfactorybean (spring 2.5).

thanks

yes, it's normal behaviour.

see 7.6.1 understanding aop proxies explanation , workarounds. see spring - @transactional - happens in background?.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -