Thanks, Seigfried!
You solved two of my problems at once. I was having an issue with the
connection pool running out of connections; Transaction.commit(conn) instead
of conn.commit() solves that. The other issue was that I didn't specify the
connection when I ran Peer.executeStatement, so even though I created a
connection, it wasn't doing me any good.
Here is the corrected code in case it might help somebody:
Connection conn = Transaction.begin(dbName);
DbaTablespacesPeer.executeStatement(
"alter tablespace " + tablespace + " end backup",
conn);
Transaction.commit(conn);
Thanks again,
Maury
> -----Original Message-----
> From: "G�schl,Siegfried" [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 03, 2004 8:21 AM
> To: Apache Torque Users List
> Subject: RE: Transaction Management?
>
> 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:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]