You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by er...@aftenposten.no on 2006/10/03 16:57:01 UTC

SV: Automatic rollback with Spring for junit tests ? SOLUTION :-)

Hi there!

 

I was struggling with this problem, then I finally realized the problem, ME :-)

 

I have been using Hibernate with Spring (someone else has setup the transactionManager stuff), and when 
I realized what I was actually missing... then wola :-) This line here in the spring-dao.xml file of course :-)

 

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

        <property name="dataSource">

            <ref bean="dataSource"/>

        </property>

    </bean>

 

But are other better ways to do it ?

 

--

 

Anyway nice Ibatis/Spring links:

 

http://www.learntechnology.net/struts-spring-ibatis.do   (The example I was using, but they didn't have the transactionManager setup)

 

Reading this I figured it all out :-)

 

http://www.springframework.org/docs/reference/orm.html#orm-ibatis

 

 

Take care,

Erlend

 


Re: Automatic rollback with Spring for junit tests ? SOLUTION :-)

Posted by Jerome Gagner <ph...@gmail.com>.
Just use AbstractTransactionalDatabaseTestCase or whatever it's
called. Works great for me. That may not be what it's called, springs
site is down right now and I can't look up the exact answer.


HTH

-Jerome

On 10/3/06, erlend.bjorge@aftenposten.no <er...@aftenposten.no> wrote:
>
>
>
>
> Hi there!
>
>
>
> I was struggling with this problem, then I finally realized the problem, ME
> J
>
>
>
> I have been using Hibernate with Spring (someone else has setup the
> transactionManager stuff), and when
>  I realized what I was actually missing… then wola J This line here in the
> spring-dao.xml file of course J
>
>
>
>     <bean id="transactionManager"
> class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
>
>         <property name="dataSource">
>
>             <ref bean="dataSource"/>
>
>         </property>
>
>     </bean>
>
>
>
> But are other better ways to do it ?
>
>
>
> --
>
>
>
> Anyway nice Ibatis/Spring links:
>
>
>
> http://www.learntechnology.net/struts-spring-ibatis.do
> (The example I was using, but they didn't have the transactionManager setup)
>
>
>
> Reading this I figured it all out J
>
>
>
> http://www.springframework.org/docs/reference/orm.html#orm-ibatis
>
>
>
>
>
> Take care,
>
> Erlend
>
>