db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aury G. Friedman" <tor...@fastestdog.com>
Subject Exception in BaseXxxx.save() leaves alreadyInSave=true
Date Tue, 17 Jun 2003 12:50:20 GMT
Hello. When I call xxxx.save()  and there is a SQL exception in its
BaseXxxx.save(), Torque does not set the alreadyInSave flag to false. It
rolls back the transaction and rethrows an exception, which is cool. But
since the flag is not reset, it will never again attempt to save the record.

 
Because the flag is private, the calling class itself can not alter the
flag. So I am left with altering the method in the base class to look like:
 
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
         try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            alreadyInSave=false; // added to prevent Torque from never
attempting to save the record
            throw e;
        }
     }

Am I missing something or is this a bug in Torque?
 
Thanks,
Aury G. Friedman
 
 
 


Mime
View raw message