db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattba...@apache.org
Subject cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer StatementManager.java
Date Sun, 02 Feb 2003 03:39:19 GMT
mattbaird    2003/02/01 19:39:19

  Modified:    src/java/org/apache/ojb/broker/singlevm
                        PersistenceBrokerImpl.java
               src/java/org/apache/ojb/broker/accesslayer
                        StatementManager.java
  Log:
  use new platform-aware close on resultsetandstatement in the finally block to avoid leaking
resources. Also use NOT_SCROLLABLE query for performance reasons.
  
  Revision  Changes    Path
  1.121     +7 -6      jakarta-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs//jakarta-ojb/src/java/org/apache/ojb/broker/singlevm/PersistenceBrokerImpl.java,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- PersistenceBrokerImpl.java	1 Feb 2003 18:39:58 -0000	1.120
  +++ PersistenceBrokerImpl.java	2 Feb 2003 03:39:19 -0000	1.121
  @@ -838,7 +838,7 @@
        */
       private Collection getMtoNImplementor(CollectionDescriptor cod, Object obj)
       {
  -        ResultSetAndStatement rs;
  +        ResultSetAndStatement rs = null;
           List result = new ArrayList();
           ClassDescriptor cld = getDescriptorRepository().getDescriptorFor(obj.getClass());
           Object[] pkValues = brokerHelper.getKeyValues(cld, obj);
  @@ -849,7 +849,7 @@
   
           try
           {
  -            rs = dbAccess.executeSQL(selectStmt, cld, pkValues);
  +            rs = dbAccess.executeSQL(selectStmt, cld, pkValues, Query.NOT_SCROLLABLE);
               while (rs.m_rs.next())
               {
                   Object[] row = new Object[fkColumns.length];
  @@ -859,14 +859,15 @@
                   }
                   result.add(new Key(row));
               }
  -            rs.m_rs.close();
  -            rs.m_stmt.close();
           }
           catch (Exception e)
           {
               throw new PersistenceBrokerException(e);
           }
  -
  +		finally
  +		{
  +			rs.close();
  +		}
           return result;
       }
   
  
  
  
  1.21      +1 -2      jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java
  
  Index: StatementManager.java
  ===================================================================
  RCS file: /home/cvs//jakarta-ojb/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- StatementManager.java	19 Jan 2003 17:20:16 -0000	1.20
  +++ StatementManager.java	2 Feb 2003 03:39:19 -0000	1.21
  @@ -173,7 +173,6 @@
           {
               if (log.isDebugEnabled()) log.debug("Statement closing failed", ignored);
           }
  -
       }
   
       /**
  
  
  

Mime
View raw message