openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r1080969 - in /openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel: BatchingPreparedStatementManagerImpl.java PreparedStatementManagerImpl.java
Date Sat, 12 Mar 2011 18:44:27 GMT
Author: mikedd
Date: Sat Mar 12 18:44:27 2011
New Revision: 1080969

URL: http://svn.apache.org/viewvc?rev=1080969&view=rev
Log:
use generics, remove unused imports

Modified:
    openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
    openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java

Modified: openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java?rev=1080969&r1=1080968&r2=1080969&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
(original)
+++ openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
Sat Mar 12 18:44:27 2011
@@ -26,7 +26,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.schema.Column;
 import org.apache.openjpa.jdbc.sql.Row;
@@ -34,7 +33,6 @@ import org.apache.openjpa.jdbc.sql.RowIm
 import org.apache.openjpa.jdbc.sql.SQLExceptions;
 import org.apache.openjpa.kernel.OpenJPAStateManager;
 import org.apache.openjpa.lib.jdbc.ReportingSQLException;
-import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.util.OptimisticException;
 
@@ -53,7 +51,7 @@ public class BatchingPreparedStatementMa
             .forPackage(BatchingPreparedStatementManagerImpl.class);
 
     private String _batchedSql = null;
-    private List _batchedRows = new ArrayList();
+    private List<RowImpl> _batchedRows = new ArrayList<RowImpl>();
     private int _batchLimit;
     private boolean _disableBatch = false;
 
@@ -138,7 +136,7 @@ public class BatchingPreparedStatementMa
      * prepared statements.
      */
     protected void flushBatch() throws SQLException {
-        List batchedRows = getBatchedRows();
+        List<RowImpl> batchedRows = getBatchedRows();
         String batchedSql = getBatchedSql();
         if (batchedRows == null)
             return;
@@ -151,15 +149,15 @@ public class BatchingPreparedStatementMa
                 ps = prepareStatement(batchedSql);
                 if (batchSize == 1) {
                     // execute a single row.
-                    onerow = (RowImpl) batchedRows.get(0);
+                    onerow = batchedRows.get(0);
                     flushSingleRow(onerow, ps);
                 } else {
                     // cache has more than one rows, execute as batch.
                     int count = 0;
                     int batchedRowsBaseIndex = 0;
-                    Iterator itr = batchedRows.iterator();
+                    Iterator<RowImpl> itr = batchedRows.iterator();
                     while (itr.hasNext()) {
-                        onerow = (RowImpl) itr.next();
+                        onerow = itr.next();
                         if (_batchLimit == 1) {
                             flushSingleRow(onerow, ps);
                         } else {
@@ -220,7 +218,7 @@ public class BatchingPreparedStatementMa
                           }
                           throw SQLExceptions.getStore(se, ps, _dict);
                       }
-                      throw SQLExceptions.getStore(se, ((RowImpl)(_batchedRows.get(index))).getFailedObject(),
_dict);
+                      throw SQLExceptions.getStore(se, (_batchedRows.get(index)).getFailedObject(),
_dict);
                   }                    
                 }
                 else{
@@ -277,7 +275,7 @@ public class BatchingPreparedStatementMa
         int cnt = 0;
         int updateSuccessCnt = _dict.getBatchUpdateCount(ps);
         Object failed = null;
-        List batchedRows = getBatchedRows();
+        List<RowImpl> batchedRows = getBatchedRows();
         for (int i = 0; i < count.length; i++) {
             cnt = count[i];
             RowImpl row = (RowImpl) batchedRows.get(batchedRowsBaseIndex + i);
@@ -344,7 +342,7 @@ public class BatchingPreparedStatementMa
         _batchLimit = batchLimit;
     }
 
-    public List getBatchedRows() {
+    public List<RowImpl> getBatchedRows() {
         return _batchedRows;
     }
 

Modified: openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java?rev=1080969&r1=1080968&r2=1080969&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java
(original)
+++ openjpa/branches/2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java
Sat Mar 12 18:44:27 2011
@@ -64,7 +64,7 @@ public class PreparedStatementManagerImp
     protected transient Log _log = null;
 
     // track exceptions
-    protected final Collection _exceptions = new LinkedList();
+    protected final Collection<Exception> _exceptions = new LinkedList<Exception>();
 
     /**
      * Constructor. Supply connection.
@@ -77,7 +77,7 @@ public class PreparedStatementManagerImp
             _log = store.getConfiguration().getLog(JDBCConfiguration.LOG_JDBC);
     }
 
-    public Collection getExceptions() {
+    public Collection<Exception> getExceptions() {
         return _exceptions;
     }
 



Mime
View raw message