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 Sat, 26 Nov 2005 02:21:12 GMT
arminw      2005/11/25 18:21:12

  Modified:    src/java/org/apache/ojb/broker/util/sequence Tag:
                        OJB_1_0_RELEASE SequenceManagerNextValImpl.java
  Log:
  use PreparedStatement for sequence id lookup
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.17.2.3  +6 -5      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.17.2.2
  retrieving revision 1.17.2.3
  diff -u -r1.17.2.2 -r1.17.2.3
  --- SequenceManagerNextValImpl.java	17 Aug 2005 13:54:37 -0000	1.17.2.2
  +++ SequenceManagerNextValImpl.java	26 Nov 2005 02:21:11 -0000	1.17.2.3
  @@ -17,6 +17,7 @@
   
   import java.sql.ResultSet;
   import java.sql.Statement;
  +import java.sql.PreparedStatement;
   
   import org.apache.commons.lang.SystemUtils;
   import org.apache.ojb.broker.PersistenceBroker;
  @@ -116,7 +117,7 @@
        */
       protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException
       {
  -        long result = 0;
  +        long result;
           // lookup sequence name
           String sequenceName = calculateSequenceName(field);
           try
  @@ -156,13 +157,13 @@
       protected long buildNextSequence(ClassDescriptor cld, String sequenceName) throws Exception
       {
           ResultSet rs = null;
  -        Statement stmt = null;
  +        PreparedStatement stmt = null;
           long result = -1;
           StatementManagerIF stmtMan = getBrokerForClass().serviceStatementManager();
           try
           {
  -            stmt = stmtMan.getGenericStatement(cld, Query.NOT_SCROLLABLE);
  -            rs = stmt.executeQuery(getPlatform().nextSequenceQuery(sequenceName));
  +            stmt = stmtMan.getPreparedStatement(cld, getPlatform().nextSequenceQuery(sequenceName)
,Query.NOT_SCROLLABLE, 1, false);
  +            rs = stmt.executeQuery();
               rs.next();
               result = rs.getLong(1);
           }
  
  
  

---------------------------------------------------------------------
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