{
myQueryId = myIdGenerator.getNextIntegerId();
}
catch (IdException ie)
{
throw new QueryException("Unable to get myQueryId. ");
}
// ===================================================
// Add each ObjectKey to sql batch insert statement
// ===================================================
ObjectKey oneKey = null;
String insertStatement = null;
// modified by aleks
aStatement = myConnection.createStatement();
// modified by aleks
for (Iterator i = objectKeys.iterator(); i.hasNext();)
{
ObjectKey oneObj = (ObjectKey) i.next();
if (oneObj != null)
{
oneKey = oneObj;
log.info("UniqueId of ObjectKey: " + oneKey.getUniqueId().toString());
insertStatement = "INSERT INTO QueryJoin (ObjectId, QueryId, name, alias) VALUES ('"
+ oneKey.getUniqueId().toString() + "', " + myQueryId + ", '" + oneKey.getName()
+ "', '" + oneKey.getAlias() + "')";
log.debug("Running statement '" + insertStatement.toString() + "'");
aStatement.addBatch(insertStatement);
}
} //end for loop
aStatement.executeBatch();
// int [] updateCounts = aStatement.executeBatch();
// for (int i = 0; i < updateCounts.length; i++)
// {
// System.out.println("sresult of batch statement number " + i + ": " + updateCounts[i]);
// }
}
catch (java.sql.BatchUpdateException be)
{
throw new QueryException(be, "Cacheing of objectKeys in SQL table failed");
}
catch (SQLException se)
{
throw new QueryException(se, "Cacheing of objectKeys in SQL table failed");
}
catch (ServiceException svce)
{
throw new QueryException(svce);
}
// modified by aleks
finally
{
try
{
aStatement.close();
aStatement = null;
}
catch (SQLException se)
{
throw new QueryException(se);
}
}
// modified by aleks
return myQueryId;