db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcna...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/oid IDBroker.java
Date Wed, 20 Aug 2003 19:13:15 GMT
jmcnally    2003/08/20 12:13:15

  Modified:    src/java/org/apache/torque/oid Tag: TORQUE_3_0_BRANCH
                        IDBroker.java *
                        src/java/org/apache/torque/oid/IDBroker.java - do
                        not call commit or rollback methods if using a
                        connection passed in through the arguments.
  Log:
  Issue number: TRQ4 - idbroker commits and closes connection.  The connection
  may be in the middle of a larger transaction, so idbroker should leave
  transaction management to the calling code.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.20.2.1  +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.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
                       
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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;
               }
   
  
  
  
  No                   revision
  
  Index: IDBroker.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/oid/IDBroker.java,v
  retrieving revision 1.20
  retrieving revision 1.20.2.1
  diff -u -r1.20 -r1.20.2.1
  --- IDBroker.java	26 Nov 2002 23:46:56 -0000	1.20
  +++ IDBroker.java	20 Aug 2003 19:13:15 -0000	1.20.2.1
  @@ -644,10 +644,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)
                   {
                       String databaseName = dbMap.getName();
                       connection = Transaction.beginOptional(dbMap.getName(), transactionsSupported);
  @@ -670,11 +671,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: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message