mpoeschl 2003/08/22 10:25:31
Modified: xdocs changes.xml
src/java/org/apache/torque/oid IDBroker.java
Log:
TRQ4: Transaction mismanagement in IDBroker.
Revision Changes Path
1.106 +3 -0 db-torque/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- changes.xml 22 Aug 2003 17:01:42 -0000 1.105
+++ changes.xml 22 Aug 2003 17:25:31 -0000 1.106
@@ -20,6 +20,9 @@
<li>
JdbcTrasformTask: error fetching foreign keys using an ODBC source.
</li>
+ <li>
+ TRQ4: Transaction mismanagement in IDBroker.
+ </li>
</ul>
</p>
</subsection>
1.26 +12 -5 db-torque/src/java/org/apache/torque/oid/IDBroker.java
Index: IDBroker.java
===================================================================
RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- IDBroker.java 14 May 2003 19:38:05 -0000 1.25
+++ IDBroker.java 22 Aug 2003 17:25:31 -0000 1.26
@@ -650,10 +650,11 @@
checkTiming(tableName);
}
+ boolean useNewConnection = (connection == null) || (configuration
+ .getBoolean(DB_IDBROKER_USENEWCONNECTION, true));
try
{
- if (connection == null || configuration
- .getBoolean(DB_IDBROKER_USENEWCONNECTION, true))
+ if (useNewConnection)
{
connection = Transaction.beginOptional(dbMap.getName(),
transactionsSupported);
@@ -676,11 +677,17 @@
BigDecimal newNextId = nextId.add(quantity);
updateNextId(connection, tableName, newNextId.toString());
- Transaction.commit(connection);
+ if (useNewConnection)
+ {
+ Transaction.commit(connection);
+ }
}
catch (Exception e)
{
- Transaction.rollback(connection);
+ if (useNewConnection)
+ {
+ Transaction.rollback(connection);
+ }
throw e;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]