ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Beekman" <n.beek...@wis.nl>
Subject RE: manage transaction
Date Wed, 08 Mar 2006 14:53:48 GMT
Hi,

You provided the following properties in a previous mail:

> <property name="SetAutoCommitAllowed" value="false"/>
> <property name="DefaultAutoCommit" value="false"/>

Change "SetAutoCommitAllowed" to "true" and it will work.

Niels

-----Original Message-----
From: Cesar Villar [mailto:cesarvillarcar@yahoo.es] 
Sent: woensdag 8 maart 2006 13:26
To: user-java@ibatis.apache.org
Subject: RE: manage transaction

I prove with that option but the behavior was the
same. If I don´t use
sqlMapClient.getCurrentConnection().setAutoCommit(false)
I can´t disable autocommit with xml config file.
Thanks.
 --- Meindert <meindert@pastelebusiness.com> escribió:

> In your config;  
> <transactionManager commitRequired="true"
> type="EXTERNAL">
> 
> 
> Jeff Butler wrote on Tuesday;
> If you use an EXTERNAL transaction manager, then
> iBATIS does not do commits
> or rollbacks - even if you call the methods, they do
> nothing at all -
> because you've declared you are using an external
> transaction manager.
> 
> Does that help?
> 
>  Meindert
> -----Original Message-----
> From: Cesar Villar [mailto:cesarvillarcar@yahoo.es] 
> Sent: 08 March 2006 11:59 AM
> To: user-java@ibatis.apache.org
> Subject: RE: manage transaction
> 
> Thanks!!
> I've changed the reference of ibatis.com to
> ibatis.apache.org, but the problem is still there.
> The only way that solve the question is to set
> autocommit programatically before starting
> transaction
> try{
>
getMapCliente().getCurrentConnection().setAutoCommit(false);
>  getMapCliente().startTransaction();
>  int res = getDao().deleteProyectos(l);
>  BUSFactory.getItemBUS().deleteItemsByProyectos(l);
>  getMapCliente().commitTransaction();
>  return res;
> }finally{
>  getMapCliente().endTransaction();
> }
> 
> but i don't think that it's the right way.
> Thanks.
>  --- Meindert <meindert@pastelebusiness.com>
> escribió:
> 
> > You have a reference to ibatis.com;
> > <!DOCTYPE daoConfig PUBLIC "-//iBATIS.com//DTD DAO
> > Configuration 2.0//EN"
> > "http://www.ibatis.com/dtd/dao-2.dtd">
> > 
> > This must be;
> > <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL
> Map
> > 2.0//EN"
> > "http://ibatis.apache.org/dtd/dao-2.dtd">
> > 
> > And for the sql maps
> > <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL
> Map
> > 2.0//EN"
> > "http://ibatis.apache.org/dtd/sql-map-2.dtd">
> > 
> > MEINDERT HOVING
> > -----Original Message-----
> > From: Cesar Villar
> [mailto:cesarvillarcar@yahoo.es] 
> > Sent: 08 March 2006 11:20 AM
> > To: user-java@ibatis.apache.org
> > Subject: manage transaction
> > 
> > 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
> > 
> > -- 
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.1.375 / Virus Database: 268.2.0/276 -
> > Release Date: 07/03/2006
> >  
> > 
> > -- 
> > No virus found in this outgoing message.
> > Checked by AVG Free Edition.
> > Version: 7.1.375 / Virus Database: 268.2.0/276 -
> > Release Date: 07/03/2006
> >  
> > 
> > 
> 
> 
> 
> 		
> ______________________________________________ 
> LLama Gratis a cualquier PC del Mundo. 
> Llamadas a fijos y móviles desde 1 céntimo por
> minuto. 
> http://es.voice.yahoo.com
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.2.0/276 -
> Release Date: 07/03/2006
>  
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.2.0/276 -
> Release Date: 07/03/2006
>  
> 
> 



		
______________________________________________ 
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