ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <bharathi.m...@accenture.com>
Subject RE: transaction rollback
Date Wed, 04 Jul 2007 14:24:12 GMT
I find that each operation on the object gets committed as and when it
is executed. For example, I have defined a method insert in service
layer. I have made the service class transactional. When I invoke the
insert method on the object in a while loop, for each iteration, the
statement is getting committed.

 

@Transactional

public class PositionManagerImpl extends BaseManager implements
PositionManager {

            private PositionDao positionDao;

 

            /**

             * Set the Dao for communication with the data layer.

             * 

             * @param dao

             */

            public void setPositionDao(PositionDao dao) {

                        this.positionDao = dao;

            }

 

            /**

             * @see
com.calyon.foursight.soa.service.PositionManager#getPositions(com.calyon
.foursight.soa.model.Position)

             */

            public List getPositions(Position position) {

 

                        return positionDao.getPositions(position);

            }

 

            /**

             * @see
com.calyon.foursight.soa.service.PositionManager#addPositions(HashMap

             *      map)

             */

            public void addPositions(HashMap map) {

                        positionDao.addPositions(map);

            }

}

I am using Oracle database.

 

The config file im using is:

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

        <property name="dataSource" ref="dataSource"/>

    </bean>

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

 

    <!-- SqlMap setup for iBATIS Database Layer -->

    <bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">

        <property name="configLocation">

 
<value>classpath:/com/calyon/foursight/soa/dao/ibatis/sql-map-config.xml
</value>

        </property>

        <property name="dataSource" ref="dataSource"/>

    </bean>

 

<bean id=" positionDao" class="x.y.ibatis.positionDaoiBatis"
autowire="byName"/>

<bean id="positionManager" class=" x.y.impl.position ManagerImpl">

        <property name=" positionDao" ref=" positionDao"/>

 </bean>

 

________________________________

From: Poitras Christian [mailto:Christian.Poitras@ircm.qc.ca] 
Sent: Wednesday, July 04, 2007 6:59 PM
To: user-java@ibatis.apache.org
Subject: RE: transaction rollback

 

Spring calls rollback only when a RuntimeException is encountered.
Normal exceptions cause commits (unless stated otherwise in
@Transactional <mailto:in@Transactional>  tag).

This may be the cause of your problem.

 

If this is not the case, what database are you using? And can you send
your spring.xml file?

 

Christian

 

________________________________

From: bharathi.mani@accenture.com [mailto:bharathi.mani@accenture.com] 
Sent: Wednesday, 04 July 2007 01:36
To: user-java@ibatis.apache.org
Subject: transaction rollback

Hi, 

I am using Spring and iBatis. I am trying to make an object
transactional by marking the object @transactional using annotational
transaction management of Spring. But on doing this no rollback seems to
happen if the object throws an exception. And also from logs I find that
each SQL statement in iBatis is getting committed as its executed. As a
result, no rollback happens when there is any exception. Any help on
this will be great.

 

Thanks,

Bharathi

This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete
the original. Any other use of the email by you is prohibited.



This message is for the designated recipient only and may contain privileged, proprietary,
or otherwise private information.  If you have received it in error, please notify the sender
immediately and delete the original.  Any other use of the email by you is prohibited.

Mime
View raw message