Announcement Announcement Module
Collapse
No announcement yet.
EJB BMT Spring transaction propagation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • EJB BMT Spring transaction propagation

    Hello,

    I would know if it is possible to propagate the transaction with the Spring transaction attribute set to PROPAGATION_REQUIRED using the JtaTransactionManager when you invoke a local stateless EJB (BMT) with the Spring LocalStatelessSessionProxyFactoryBean helper class ?

    If not, how can I propagate myself the transaction (with BMT) ?

    I can see in my log file that a new transaction is open :

    Code:
    //invoke EJB
    [JtaTransactionManager] Using transaction object [org.springframework.transaction.jta.JtaTransactionObject@14a3622]
    [JtaTransactionManager] Creating new transaction with name [com.cwsoft.commons.model.service.GenericServiceRemoteInterface.executeOperation]
    [TransactionInterceptor] Getting transaction for com.cwsoft.commons.model.service.GenericServiceRemoteInterface.executeOperation
    [TransactionSynchronizationManager] Retrieved value [org.springframework.orm.hibernate3.SessionHolder@103b7e8] for key [org.hibernate.impl.SessionFactoryImpl@1473306] bound to thread [http-0.0.0.0-8080-3]
    [JtaTransactionManager] Using transaction object [org.springframework.transaction.jta.JtaTransactionObject@1385f78]
    [JtaTransactionManager] Participating in existing transaction
    [TransactionInterceptor] Getting transaction for com.cwsoft.otherapp.service.OtherService.method
    Here are my configuration files :

    - the client part : (a jta transaction is open by the client)
    Code:
    <bean id="otherService" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean" 
    lazy-init="true">
          <property name="jndiName">
                <value>ejb/OtherServiceLocal</value>
          </property>
          <property name="businessInterface">   <value>com.cwsoft.commons.model.service.GenericServiceInterface</value>
          </property>
    </bean>
    and :

    - the service part :
    Code:
    <bean id="otherServiceTarget" class="com.cwsoft.otherapp.service.impl.OtherServiceImpl">
           <property name="this" ref="otherService" />
    </bean>
    
    <bean id="otherService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager">
             <ref bean="transactionManager" />
        </property>
        <property name="target">
               <bean class="com.cwsoft.commons.spring.aop.target.CWTargetSource">
            	<property name="targetBeanName">
            		<idref local="otherServiceTarget" />
            	</property>
            </bean>
         </property>
         <property name="transactionAttributes">
                <props>
                	<prop key="executeOperation">
    		    	PROPAGATION_REQUIRED,-CWException
    	        </prop>
                    <prop key="method">
                            PROPAGATION_REQUIRED,-CWException
                    </prop>
                   </props>
           </property>
    </bean>
    <bean id="transactionManager" 
    			class="org.springframework.transaction.jta.JtaTransactionManager">
    	<property name="transactionManagerName" value="java:/TransactionManager"/>
    	<property name="userTransactionName" value="UserTransaction"></property>
    </bean>
Working...
X