From 7d0de515a5d9949e738a1b55fc9d36b644ddb91e Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Sat, 12 Mar 2011 17:38:43 +0000 Subject: [PATCH] use generics, remove unused imports git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1080955 13f79535-47bb-0310-9956-ffa450edef68 --- .../BatchingPreparedStatementManagerImpl.java | 18 ++++++++---------- .../kernel/PreparedStatementManagerImpl.java | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java index 37739f4ae..8fd21055d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java @@ -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.RowImpl; 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 BatchingPreparedStatementManagerImpl extends .forPackage(BatchingPreparedStatementManagerImpl.class); private String _batchedSql = null; - private List _batchedRows = new ArrayList(); + private List _batchedRows = new ArrayList(); private int _batchLimit; private boolean _disableBatch = false; @@ -138,7 +136,7 @@ public class BatchingPreparedStatementManagerImpl extends * prepared statements. */ protected void flushBatch() throws SQLException { - List batchedRows = getBatchedRows(); + List batchedRows = getBatchedRows(); String batchedSql = getBatchedSql(); if (batchedRows == null) return; @@ -151,15 +149,15 @@ public class BatchingPreparedStatementManagerImpl extends 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 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 BatchingPreparedStatementManagerImpl extends } 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 BatchingPreparedStatementManagerImpl extends int cnt = 0; int updateSuccessCnt = _dict.getBatchUpdateCount(ps); Object failed = null; - List batchedRows = getBatchedRows(); + List 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 BatchingPreparedStatementManagerImpl extends _batchLimit = batchLimit; } - public List getBatchedRows() { + public List getBatchedRows() { return _batchedRows; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java index 29b51e48d..d3cabcad1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedStatementManagerImpl.java @@ -64,7 +64,7 @@ public class PreparedStatementManagerImpl protected transient Log _log = null; // track exceptions - protected final Collection _exceptions = new LinkedList(); + protected final Collection _exceptions = new LinkedList(); /** * Constructor. Supply connection. @@ -77,7 +77,7 @@ public class PreparedStatementManagerImpl _log = store.getConfiguration().getLog(JDBCConfiguration.LOG_JDBC); } - public Collection getExceptions() { + public Collection getExceptions() { return _exceptions; }