I'm using EJB3 with Oracle database and JDBC.
I'm working on an app where I have to fire 25000 UPDATE
queries.
My code is as follows:
public int updateStatus(List<String> idList) {
Connection connection = getConnection(); // Connection initialized properly for oracle db
statement = connection.createStatement();
String sql = null;
for (String id : idlist) { // idList is properly filled
sql = "UPDATE TBLTEST SET STATUS = 'FIXED' WHERE ID = '" + id + "'";
statement.addBatch(sql);
}
int[] affectedRecords = statement.executeBatch();
}
Please note, the class in which this method is written, is annotated as
@TransactionManagement(TransactionManagementType.CONTAINER)
This code is working perfectly fine upto 8000 queries. For more id
s, it throws the following exception:
org.jboss.util.NestedSQLException: Transaction TransactionImple < ac, BasicAction: 0:ffffc0a80272:1652:56bd6be5:57e status: ActionStatus.ABORTED > cannot proceed STATUS_ROLLEDBACK; - nested throwable: (javax.transaction.RollbackException: Transaction TransactionImple < ac, BasicAction: 0:ffffc0a80272:1652:56bd6be5:57e status: ActionStatus.ABORTED > cannot proceed STATUS_ROLLEDBACK)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.checkTransactionActive(WrapperDataSource.java:165)
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransactionActive(WrappedConnection.java:843)
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:858)
at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:835)
at org.jboss.resource.adapter.jdbc.WrappedConnection.createStatement(WrappedConnection.java:183)
Can anyone help with the exception?