Results 1 to 3 of 3

Thread: Problems with declarative jdbc transactions

  1. #1
    Join Date
    Apr 2005
    Posts
    2

    Default Problems with declarative jdbc transactions

    Hi, i have serious problems with jdbc declarative transactions on spring i think i'm doing something wrong.

    i have this configuration on my beans.xml

    <beans>
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource" >
    <property name="driverClassName"><value>driver</value></property>
    <property name="url"><value>url</value></property>
    <property name="username"><value>user</value></property>
    <property name="password"><value>password</value></property>
    </bean>
    <bean id="resultSetExtractor" class="com.ya.isp2.kernel2.dao.ResultSetReader"/>
    <bean id="dataSourceTransactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource" ><ref local="dataSource"/></property>
    </bean>
    <bean id="ContractDAO" class="com.ya.isp2.kernel2.dao.ContractDAOTest">
    <property name="dataSource"><ref local="dataSource"></ref> </property>
    <property name="resultSetExtractor"><ref local="resultSetExtractor"></ref> </property>
    </bean>
    <bean id="Contract" class="com.ya.isp2.kernel2.business.contract.Contr act" singleton="false" >
    <property name="dao"><ref local="ContractDAO"/></property>
    </bean>
    <bean id="proxy" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
    <property name="transactionManager"><ref local="dataSourceTransactionManager"/></property>
    <property name="target"><ref local="Contract"></ref></property>
    <property name="transactionAttributes">
    <props>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
    </props>
    </property>
    </bean>
    </beans>

    but when i call the methods of the class ContractDAOTest each methods of the transaction gets a new connection and do the commit each time, and i try to force runtime exceptions at the end of the methods for doing the rollback of the transactions and the transaction has done the commit, i'm not sure what i'm doing wrong , i hope some of you could help with that.

    Another thing, i've change the configuration a lot of time in the property target of the transaction bean, i used either contract and contractdaotest, and the result is the same

    Amm, sorry for my english level , i hope you could understand me.

  2. #2

    Default

    Hi, your config looks ok. How are you obtaining your Contract(DAO) bean from the BeanFactory?

  3. #3
    Join Date
    Apr 2005
    Posts
    2

    Default

    Hi, I've realized that i was calling the bean contract, and not the bean proxy , from now on it seems that the transaction is propagated to each methods so maybe i will not have more problems. Thanks a lot

Similar Threads

  1. Replies: 2
    Last Post: Jul 7th, 2005, 04:02 PM
  2. Replies: 4
    Last Post: Apr 19th, 2005, 08:24 AM
  3. Replies: 4
    Last Post: Jan 25th, 2005, 02:46 PM
  4. Replies: 10
    Last Post: Nov 2nd, 2004, 09:38 AM
  5. Replies: 1
    Last Post: Oct 15th, 2004, 10:35 PM

Posting Permissions

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