db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/sequence SequenceManagerNextValImpl.java
Date Fri, 19 Dec 2003 17:30:22 GMT
arminw      2003/12/19 09:30:22

  Modified:    src/java/org/apache/ojb/broker/util/sequence
                        SequenceManagerNextValImpl.java
  Log:
  again do better resource handle
  
  Revision  Changes    Path
  1.13      +13 -12    db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
  
  Index: SequenceManagerNextValImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SequenceManagerNextValImpl.java	19 Dec 2003 16:56:13 -0000	1.12
  +++ SequenceManagerNextValImpl.java	19 Dec 2003 17:30:22 -0000	1.13
  @@ -54,17 +54,17 @@
    * <http://www.apache.org/>.
    */
   
  +import java.sql.ResultSet;
  +import java.sql.Statement;
  +
   import org.apache.commons.lang.SystemUtils;
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
  +import org.apache.ojb.broker.accesslayer.StatementManagerIF;
   import org.apache.ojb.broker.metadata.ClassDescriptor;
   import org.apache.ojb.broker.metadata.FieldDescriptor;
   import org.apache.ojb.broker.query.Query;
  -
  -import java.sql.ResultSet;
  -import java.sql.SQLException;
  -import java.sql.Statement;
  +import org.apache.ojb.broker.util.logging.Logger;
  +import org.apache.ojb.broker.util.logging.LoggerFactory;
   
   /**
    * This SequenceManager implementation uses database
  @@ -188,7 +188,6 @@
                   throw new SequenceManagerException("Could not grab next id, sequence seems
to exist", e);
               }
           }
  -
           return result;
       }
   
  @@ -197,16 +196,17 @@
           ResultSet rs = null;
           Statement stmt = null;
           long result = -1;
  +        StatementManagerIF stmtMan = getBrokerForClass().serviceStatementManager();
           try
           {
  -            stmt = getBrokerForClass().serviceStatementManager().getGenericStatement(cld,
Query.NOT_SCROLLABLE);
  +            stmt = stmtMan.getGenericStatement(cld, Query.NOT_SCROLLABLE);
               rs = stmt.executeQuery(getPlatform().nextSequenceQuery(sequenceName));
               rs.next();
               result = rs.getLong(1);
           }
           finally
           {
  -            getBrokerForClass().serviceStatementManager().closeResources(stmt, rs);
  +            stmtMan.closeResources(stmt, rs);
           }
           return result;
       }
  @@ -214,9 +214,10 @@
       protected void createSequence(ClassDescriptor cld, String sequenceName) throws Exception
       {
           Statement stmt = null;
  +        StatementManagerIF stmtMan = getBrokerForClass().serviceStatementManager();
           try
           {
  -            stmt = getBrokerForClass().serviceStatementManager().getGenericStatement(cld,
Query.NOT_SCROLLABLE);
  +            stmt = stmtMan.getGenericStatement(cld, Query.NOT_SCROLLABLE);
               stmt.execute(getPlatform().dropSequenceQuery(sequenceName));
           }
           catch (Exception ignore)
  @@ -226,7 +227,7 @@
           {
               try
               {
  -                getBrokerForClass().serviceStatementManager().closeResources(stmt, null);
  +                stmtMan.closeResources(stmt, null);
               }
               catch (Exception ignore)
               {
  
  
  

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


Mime
View raw message