ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cesar Villar <cesarvillar...@yahoo.es>
Subject manage transaction
Date Wed, 08 Mar 2006 09:19:36 GMT
Hello everybody!!! I'm begginer with iBatis and i'm
having a problem.
I use DaoManager to retrieve my DAOs and sqlMapClient
to manage transactions. 
These are my configuration files:
<!DOCTYPE daoConfig PUBLIC "-//iBATIS.com//DTD DAO
Configuration 2.0//EN"
"http://www.ibatis.com/dtd/dao-2.dtd">
<daoConfig>
  <context>
    <transactionManager type="SQLMAP">
      <property name="SqlMapConfigResource"
value="sql-map-config.xml" />
    </transactionManager>
    <dao interface="CapaDAO"
implementation="impl.CapaDAOImpl"/>
  </context>
</daoConfig>

<sqlMapConfig>
  <properties resource="db.properties" />
  <settings useStatementNamespaces="true" />
  <transactionManager commitRequired="true"
type="EXTERNAL">
    <property name="SetAutoCommitAllowed"
value="false"/>
    <property name="DefaultAutoCommit" value="false"/>
    <dataSource type="SIMPLE">
	  <property name="JDBC.DefaultAutoCommit"
value="false"/>
      <property name="JDBC.Driver" value="${driver}"/>
      <property name="JDBC.ConnectionURL"
value="${url}"/>
      <property name="JDBC.Username"
value="${username}"/>
      <property name="JDBC.Password"
value="${password}"/>
      <property name="Pool.MaximumCheckoutTime"
value="1000"/>
      <property name="Pool.TimeToWait" value="1000"/>
    </dataSource>
  </transactionManager> 
  <sqlMap resource=" ......

The question is that i want to manage the transaction
from my business classes. I want iBatis to commit o
rollback when I need. In one of my business classes i
have the following code:
		try{
			getMapCliente().startTransaction();
			int res = getDao().deleteProyectos(l);
			BUSFactory.getItemBUS().deleteItemsByProyectos(l);
			getMapCliente().commitTransaction();
			return res;
		}finally{
			getMapCliente().endTransaction();
		}

I throw an Exception from the method
BUSFactory.getItemBUS().deleteItemsByProyectos(l), so
a rollback has to be executed. But, actually, after
getDao().deleteProyectos(l) a commit is executed
instead of a rollback.
What am i doing wrong?
I'm using eclipse 3.1, iBatis 2.1.5 and MySQL 5.0.18

Thanks a lot


		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com

Mime
View raw message