db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Göschl,Siegfried" <Siegfried.Goes...@drei.com>
Subject RE: Transaction Management?
Date Thu, 03 Jun 2004 13:21:22 GMT
Hi Maury,

There is something wrong with your code -- conn.commit() does not return the conection into
the pool. But this might not be your problem

I use the following testcase for transaction handling on Oracle 9i

			con = Transaction.begin( "WEBSHOP" );

			Systemproperty systemProperty1 = new Systemproperty();

			systemProperty1.setName( "FOO" );
			systemProperty1.setValue( "BAR" );
			systemProperty1.setCreationdate( new Date() );
			systemProperty1.setModificationdate( new Date() );
			systemProperty1.save(  con );

			Systemproperty systemProperty2 = new Systemproperty();

			systemProperty2.setName( "FOO" );
			systemProperty2.setValue( "FOO" );
			systemProperty2.setCreationdate( new Date() );
			systemProperty2.setModificationdate( new Date() );
			systemProperty2.save(  con );
			
			Transaction.commit(con);

			fail( "There was no exeception inserting a duplicate key");
		}

		catch( TorqueException e )
		{
			Transaction.safeRollback(con);
		}

Cheers,

Siegfried Goeschl

-----Original Message-----
From: Jarrell, Maury [mailto:Maury.Jarrell@fhr.com] 
Sent: Donnerstag, 03. Juni 2004 15:16
To: Torque Users List
Subject: Transaction Management?


Hello all,

Where would I go to find out how transactions are managed in Torque?  I've looked over the
web site, the Wiki, and the mailing list archives and haven't found an explanation.

I'm writing a backup routine using Torque to backup Oracle databases.  I'm using the peer
class generated by Torque to issue the 'alter tablespace tbsp_name begin backup' and 'alter
tablespace tbsp_name end backup' statements.

In doing so I'm running into "ORA-01453: SET TRANSACTION must be first statement of transaction"
errors.  I've tried using the Connection object explicitly as in:

          Connection conn = Transaction.begin(database);
          DbaTablespacesPeer.executeStatement(
            "alter tablespace " + tablespace + " end backup",
            database);
          conn.commit();

This isn't working.  This is particularly frustrating since these statements can't be rolled
back and thus don't need transactions at all.

Any nudge in the right direction would be appreciated.

Thanks,
Maury


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message