Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Configuration file: There is no additional configuration.
  • Commit and rollback are processed directly on the source.
    SetAutoCommit(false) must be called in order to process as a transaction.
    Note that setAutoCommit(false) must be called when selecting blobs.

1-2. When to use TransactionTemplate

...

  • Configuration file

    Code Block
    languagexml
     <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
         <property name="configLocation"><value>sqlmap.xml</value></property>
         <property name="dataSource"><ref bean="dataSource" /></property>
         <property name="lobHandler"><ref bean="defaultLobHandler"/></property>
         <property name="transactionConfigProperties">
            <props>
               <prop key="DefaultAutoCommit">false</prop>
               <prop key="SetAutoCommitAllowed">true</prop>
            </props>
         </property>
     </bean>     
     <bean id="txProxyTemplate" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
       <property name="transactionManager">
        <ref local="transactionManager"></ref>   
       </property>
       <property name="transactionAttributes">
        <props>
         <prop key="insert*">PROPAGATION_REQUIRED</prop>
         <prop key="update*">PROPAGATION_REQUIRED</prop>
         <prop key="delete*">PROPAGATION_REQUIRED</prop>
         <prop key="save*">PROPAGATION_REQUIRED</prop>    
         <prop key="*">PROPAGATION_SUPPORTS</prop>
        </props>
       </property>
     </bean> 
  • There is no need for transaction-related code on the source.

...