String removeAllStmt = getRemoveAllStmt(elements, ecs);
SQLController sqlControl = storeMgr.getSQLController();
try
{
ExecutionContext ec = sm.getExecutionContext();
ManagedConnection mconn = storeMgr.getConnection(ec);
try
{
PreparedStatement ps = sqlControl.getStatementForUpdate(mconn, removeAllStmt, false);
try
{
int jdbcPosition = 1;
Iterator iter = elements.iterator();
while (iter.hasNext())
{
Object element = iter.next();
jdbcPosition = BackingStoreHelper.populateOwnerInStatement(sm, ec, ps, jdbcPosition, ecs);
jdbcPosition = BackingStoreHelper.populateElementInStatement(ec, ps, element, jdbcPosition, elementMapping);
if (relationDiscriminatorMapping != null)
{
jdbcPosition =
BackingStoreHelper.populateRelationDiscriminatorInStatement(ec, ps, jdbcPosition, ecs);
}
}
int[] number = sqlControl.executeStatementUpdate(mconn, removeAllStmt, ps, true);
if (number[0] > 0)
{
modified = true;
}
}
finally
{
sqlControl.closeStatement(mconn, ps);
}
}
finally
{
mconn.release();
}
}
catch (SQLException e)
{
NucleusLogger.DATASTORE.error(e);
throw new NucleusDataStoreException(localiser.msg("056012", removeAllStmt), e);
}
try
{
// Shift the remaining indices to remove the holes in ordering
boolean batched = storeMgr.allowsBatching();
ExecutionContext ec = sm.getExecutionContext();
ManagedConnection mconn = storeMgr.getConnection(ec);
try
{
for (int i = 0; i < currentListSize; i++)
{