ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Meindert" <meind...@pastelebusiness.com>
Subject RE: Defining Transaction Isolation Using iBATIS
Date Thu, 24 May 2007 12:48:59 GMT
Hi Ralf,

 

Not sure if it will answer your question but the Ibatis ADO framework has
been depreciated.

 

We wrote a little piece in the Wiki how to convert jpetstore to the Spring
ADO framework, 

You will set the transaction isolation in the Spring configuration files (or
by annotation)

 

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Converting+iBA
TIS+DAO+to+Spring+DAO

 

This wiki is missing the changes to make for the transactions;

 

1) Add cglib-nodep-2.1_3.jar to the classpath

 

2) OrderService.java

Add the annotation for spring to implement transactions, meaning 

at @Transactional just above the insertOrder method

at @Transactional(readOnly=true)just above the getOrder method

Add a empty constructor;

public OrderService() {

}

 

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>

I didn't try but, tom told me that 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

 

 

 

-----Original Message-----




Mime
View raw message