Results 1 to 3 of 3

Thread: TransactionAwareDataSourceProxy And JtaTransactionManager

  1. #1
    Join Date
    Nov 2005
    Posts
    2

    Default TransactionAwareDataSourceProxy And JtaTransactionManager

    Hi! im have some code that uses plain JDBC and wanna put that in the springframework. I want that code to participate in the spring's managed transaction using JtaTransactionManager , and for that i tried the TransactionAwareDataSourceProxy to wrap the original datasource. But something is wrong , JTA do rolback but the connection doesnt.
    Someone has made this work?

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Can you post your configuration? Also has the connection datasource auto-commit turned on?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Nov 2005
    Posts
    2

    Default

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
      <!-- Other beans settings -->
        <bean id="dataSourceTarget" class="my.dataaccess.DataSourceImpl" factory-method="getInstance"/>
        <bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
          <property name="targetDataSource" ref="dataSourceTarget"/>
        </bean>
        <bean id="testTxTarget" class="my.TestTx">
          <property name="dataSource" ref="dataSource"/>
        </bean>
        <bean id="txManager"    class="org.springframework.transaction.jta.JtaTransactionManager"/>
        <bean id="testTx" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
          <property name="transactionManager"><ref bean="txManager"/></property>
          <property name="target"><ref bean="testTxTarget"/></property>
          <property name="transactionAttributes">
             <props>
                <prop key="handleRequest">PROPAGATION_REQUIRED,-DataAccessException</prop>
        	 </props>
           </property>
        </bean>
    </beans>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •