ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Poitras Christian" <Christian.Poit...@ircm.qc.ca>
Subject RE: converting iBATIS framework DAOs to the Spring Framework
Date Fri, 13 Apr 2007 16:08:25 GMT
Download CGLIB (at least version 2.1.3)


From: Meindert [mailto:meindert@pastelebusiness.com] 
Sent: Friday, 13 April 2007 12:03
To: user-java@ibatis.apache.org; lmeadors@apache.org
Subject: RE: converting iBATIS framework DAOs to the Spring Framework

Hi All,


I had a look at spring transactions and can get the annotation working
for the dao layer but not for the service layer?


This is the xml I added in the spring config file to enable spring
annotations (Java1.5+ required), 


    <bean id="txManager"

        <property name="dataSource">

            <ref bean="dataSource"/>







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



    <bean id="txInterceptor"

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

        <property name="transactionAttributeSource">





Step 2, Tested it on the dao layer by modifying updateAccount


public void updateAccount(Account account) {

    update("updateAccount", account);

    int i = 5/0;  //division by zero, expect rollback of account changes

    update("updateProfile", account);



This works! But if I move the annotation to the service layer like this


public void updateAccount(Account account) {



I get

org.springframework.aop.framework.AopConfigException: Cannot proxy
target class because CGLIB2 is not available. Add CGLIB to the class
path or specify proxy interfaces.


Kind Regards



-----Original Message-----
From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf
Of Larry Meadors
Sent: 12 April 2007 04:14 PM
To: user-java@ibatis.apache.org
Subject: Re: converting iBATIS framework DAOs to the Spring Framework


Thanks a TON for doing this, it's really appreciated!


Here is the WIKI Page: http://tinyurl.com/ysvjw5


I just converted it to WIKI format and corrected some simple stuff.


I was curious why if we are starting with jpetshop5, why not use the

hsqldb stuff that is there?


Also, I'd suggest that we use constructor injection instead of setter

injection - that way, we only need to remove the default constructors

from the service classes (eg., public AccountService() {...}, and the

related imports. It also prevents people from replacing the dao

instances (well, not entirely, but they have to do a bit more work).



View raw message