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 Mark Alcocer Flores <su...@yahoo.com> on 2005/03/18 18:18:18 UTC
Question about transactions.
I have a problem. I recently upgraded from the 1.2
iBatis version to the new 2.0 iBatis version. Because
of the database I connect to, I controled transactions
manually. I use the startTransaction method to start
the transaction and commitTransaction to commit it. If
anything went wrong I used the rollbackTransaction to
leave the database in a consistent state. In this new
version os iBatis the rollbackTransaction method is
not public and instead, the endTransaction method must
be use, actually I call it always in a finally
statement.
The thing is that when there is an error in the
database, in the old way, the connection close with
not problems and everything was alrigth, but with the
new way, the state of the database is inconsistent
sometimes and the connection remains open.
Can anyone give me an idea of what can I do? I think i
could go back to the old version, but this new version
has so many good features that i wouldn't want to
leave them.
Thanks in advance.
Mark.
The Greatest Thing You'll Ever Learn
It's Just To Love And Be Loved In Return
Re: Question about transactions.
Posted by Brandon Goodin <br...@gmail.com>.
using the following format will work. If your sql fails before commit
the end transaction will call rollback.
try{
startTransaction
... code goes here
commitTransaction
} finally {
endTransaciton
}
Brandon
On Fri, 18 Mar 2005 09:18:18 -0800 (PST), Mark Alcocer Flores
<su...@yahoo.com> wrote:
> I have a problem. I recently upgraded from the 1.2
> iBatis version to the new 2.0 iBatis version. Because
> of the database I connect to, I controled transactions
> manually. I use the startTransaction method to start
> the transaction and commitTransaction to commit it. If
> anything went wrong I used the rollbackTransaction to
> leave the database in a consistent state. In this new
> version os iBatis the rollbackTransaction method is
> not public and instead, the endTransaction method must
> be use, actually I call it always in a finally
> statement.
>
> The thing is that when there is an error in the
> database, in the old way, the connection close with
> not problems and everything was alrigth, but with the
> new way, the state of the database is inconsistent
> sometimes and the connection remains open.
>
> Can anyone give me an idea of what can I do? I think i
> could go back to the old version, but this new version
> has so many good features that i wouldn't want to
> leave them.
>
> Thanks in advance.
>
> Mark.
>
> The Greatest Thing You'll Ever Learn
> It's Just To Love And Be Loved In Return
>
>
Re: Question about nested transactions.
Posted by Clinton Begin <cl...@gmail.com>.
Your approach to transactions isn't going to work in iBATIS, and
likely not any other transactional framework either.
You should be demarcating transactions at a standard level within your
application. If you wish to make this simple on yourself, you could
use Spring, or I could start a discussion about how to use dynamic
proxies to achieve this.
In any case, I recommend against your current approach.
Cheers,
Clinton
On Thu, 24 Mar 2005 16:36:25 -0800, Narasimha Prasad <pr...@dbo2.com> wrote:
> Is nested transaction supported? I have a method call within a transaction
> and the method in turn starts another transaction.
>
> Example:
>
> try
> {
> startTransaction
> code.....
> method();
>
> commitTransaction
> }
> finally {
> endTransaciton
> }
>
> ------------------------------
> public method()
> {
> try
> {
> startTransaction
> code..
> commitTransaction
> }
> finally
> {
> endTransaciton
> }
> }
>
> Thanks,
> Prasad
>
> DBO2 Inc
> 650-587-0106
>
> -----Original Message-----
> From: Mark Alcocer Flores [mailto:superpchead@yahoo.com]
> Sent: Friday, March 18, 2005 9:18 AM
> To: ibatis-user-java@incubator.apache.org
> Subject: Question about transactions.
>
> I have a problem. I recently upgraded from the 1.2
> iBatis version to the new 2.0 iBatis version. Because
> of the database I connect to, I controled transactions
> manually. I use the startTransaction method to start
> the transaction and commitTransaction to commit it. If
> anything went wrong I used the rollbackTransaction to
> leave the database in a consistent state. In this new
> version os iBatis the rollbackTransaction method is
> not public and instead, the endTransaction method must
> be use, actually I call it always in a finally
> statement.
>
> The thing is that when there is an error in the
> database, in the old way, the connection close with
> not problems and everything was alrigth, but with the
> new way, the state of the database is inconsistent
> sometimes and the connection remains open.
>
> Can anyone give me an idea of what can I do? I think i
> could go back to the old version, but this new version
> has so many good features that i wouldn't want to
> leave them.
>
> Thanks in advance.
>
> Mark.
>
> The Greatest Thing You'll Ever Learn
> It's Just To Love And Be Loved In Return
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 3/15/2005
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 3/23/2005
>
>
Question about nested transactions.
Posted by Narasimha Prasad <pr...@dbo2.com>.
Is nested transaction supported? I have a method call within a transaction
and the method in turn starts another transaction.
Example:
try
{
startTransaction
code.....
method();
commitTransaction
}
finally {
endTransaciton
}
------------------------------
public method()
{
try
{
startTransaction
code..
commitTransaction
}
finally
{
endTransaciton
}
}
Thanks,
Prasad
DBO2 Inc
650-587-0106
-----Original Message-----
From: Mark Alcocer Flores [mailto:superpchead@yahoo.com]
Sent: Friday, March 18, 2005 9:18 AM
To: ibatis-user-java@incubator.apache.org
Subject: Question about transactions.
I have a problem. I recently upgraded from the 1.2
iBatis version to the new 2.0 iBatis version. Because
of the database I connect to, I controled transactions
manually. I use the startTransaction method to start
the transaction and commitTransaction to commit it. If
anything went wrong I used the rollbackTransaction to
leave the database in a consistent state. In this new
version os iBatis the rollbackTransaction method is
not public and instead, the endTransaction method must
be use, actually I call it always in a finally
statement.
The thing is that when there is an error in the
database, in the old way, the connection close with
not problems and everything was alrigth, but with the
new way, the state of the database is inconsistent
sometimes and the connection remains open.
Can anyone give me an idea of what can I do? I think i
could go back to the old version, but this new version
has so many good features that i wouldn't want to
leave them.
Thanks in advance.
Mark.
The Greatest Thing You'll Ever Learn
It's Just To Love And Be Loved In Return
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 3/15/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 3/23/2005