Ok thanks!

I had to change the header for the spring config file to make that work:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"

"http://www.springframework.org/dtd/spring-beans.dtd";>

<beans>

To

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans";

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

       xmlns:aop="http://www.springframework.org/schema/aop";

       xmlns:tx="http://www.springframework.org/schema/tx";

       xsi:schemaLocation="

       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

       http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd

       http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";>

 

Meindert

 

  _____  

From: Tom Duffey [mailto:[EMAIL PROTECTED] 
Sent: 16 April 2007 05:01 PM
To: [email protected]
Cc: [EMAIL PROTECTED]
Subject: Re: converting iBATIS framework DAOs to the Spring Framework

 

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.DataSourceTransactionManager">

<property name="dataSource">

<ref bean="dataSource"/>

</property>

</bean>

<bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCr
eator"/>

<bean
class="org.springframework.transaction.interceptor.TransactionAttributeSourc
eAdvisor">

<property name="transactionInterceptor" ref="txInterceptor"/>

</bean>

<bean id="txInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">

<property name="transactionManager" ref="txManager"/>

<property name="transactionAttributeSource">

<bean
class="org.springframework.transaction.annotation.AnnotationTransactionAttri
buteSource"/>

</property>

</bean>

You can simplify this to:

 

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

<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

Reply via email to