I'm sorting with torque-user stuff I've had flagged for awhile and came
across this one. He seems to make a good point in that
setAutoCommit(true) is being called, seemingly un-necessarily, after
rollback().

However, is this because the connection is being returned to the pool?
(Or perhaps there is some other valid reason that it is being called?)

Thanks,
Stephen

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 29, 2002 7:23 PM
> To: Turbine Torque Users List
> Subject: Interesting info on Transactions
> 
> 
> Hi everyone,
> so after having lots of issues with transactions not working for me, I
> noticed this.
> 
> The rollback()  method in Transaction class in org.apache.torque.util
> package is setting AutoCommit to true after calling rollback on the
> Connection object.
> And then in the finally block the connection is being closed.
> 
> The code is reproduced here
> 
>     public static void rollback(Connection con) throws TorqueException
>           {
>        if (con == null)
>          {
>             throw new NullPointerException(
>                 "Connection object was null. "
>                     + "This could be due to a misconfiguration of the
"
>                     + "DataSourceFactory. Check the logs and
> Torque.properties "
>                     + "to better determine the cause.");
>         }
> 
>         try
>         {
>             if (con.getMetaData().supportsTransactions()
>                 && con.getAutoCommit() == false)
>             {
>                 con.rollback();
>                 con.setAutoCommit(true);
>             }
>         }
>         catch (SQLException e)
>         {
>             category.error(
>                 "An attempt was made to rollback a transaction "
>                     + "but the database did not allow the operation to
be "
>                     + "rolled back.",
>                 e);
> 
>             throw new TorqueException(e);
>         }
>         finally
>         {
>             Torque.closeConnection(con);
>         }
>     }
> 
> 
> The con.setAutoCommit(true); call seems unnecessary to me since the
> connection is being actually closed in the Torque.closeConnection
call.
> So I commented out the con.setAutoCommit call and now when I do a
rollback
> and kill my app server(jboss) after that ,everything works
fine.(Previously
> killing my app server was resulting in database update even after a
> rollback call had been executed)
> Could this be a problem with the oracle jdbc driver??
> thanks for help
> -T
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to