ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Duffey <tduf...@utilivisor.com>
Subject Re: converting iBATIS framework DAOs to the Spring Framework
Date Mon, 16 Apr 2007 15:00:30 GMT
See below.

On Apr 16, 2007, at 9:46 AM, Meindert wrote:
> Thus larry could you add the following to finish the converting  
> from IbatisDao to springDao with ibatis sqlmaps?
>
> 3) Spring config
>
> Add the following to the spring config file;
>
> <!-- TRANSACTIONS -->
>
>     <bean id="txManager"   
> class="org.springframework.jdbc.datasource.DataSourceTransactionManage 
> r">
>
>         <property name="dataSource">
>
>             <ref bean="dataSource"/>
>
>         </property>
>
>     </bean>
>
>
>
>     <bean  
> class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoP 
> roxyCreator"/>
>
>
>
>     <bean  
> class="org.springframework.transaction.interceptor.TransactionAttribut 
> eSourceAdvisor">
>
>         <property name="transactionInterceptor" ref="txInterceptor"/>
>
>     </bean>
>
>
>
>     <bean id="txInterceptor"  
> class="org.springframework.transaction.interceptor.TransactionIntercep 
> tor">
>
>         <property name="transactionManager" ref="txManager"/>
>
>         <property name="transactionAttributeSource">
>
>             <bean  
> class="org.springframework.transaction.annotation.AnnotationTransactio 
> nAttributeSource"/>
>
>         </property>
>
>     </bean>
You can simplify this to:

>     <bean id="txManager"   
> class="org.springframework.jdbc.datasource.DataSourceTransactionManage 
> r">
>         <property name="dataSource">
>
>             <ref bean="dataSource"/>
>
>         </property>
>
>     </bean>

followed by:

<tx:annotation-driven transaction-manager="txManager"/>

You can even get rid of the transaction-manager="txManager" part if  
you rename your DataSourceTransactionManager bean to  
"transactionManager," e.g.,

<bean id="transactionManager"  
class="org.springframework.jdbc.datasource.DataSourceTransactionManager" 
 >
...
</bean>

See: http://tinyurl.com/yqncrj

Tom
Mime
View raw message