use generics, remove unused imports

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1080955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2011-03-12 17:38:43 +00:00
parent c87edf8049
commit 7d0de515a5
2 changed files with 10 additions and 12 deletions

View File

@ -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<RowImpl> _batchedRows = new ArrayList<RowImpl>();
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<RowImpl> 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<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 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<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 BatchingPreparedStatementManagerImpl extends
_batchLimit = batchLimit;
}
public List getBatchedRows() {
public List<RowImpl> getBatchedRows() {
return _batchedRows;
}

View File

@ -64,7 +64,7 @@ public class PreparedStatementManagerImpl
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 PreparedStatementManagerImpl
_log = store.getConfiguration().getLog(JDBCConfiguration.LOG_JDBC);
}
public Collection getExceptions() {
public Collection<Exception> getExceptions() {
return _exceptions;
}