public void performIndex(CompassSession session, IndexEntity[] entities) throws CompassException {
for (IndexEntity entity : entities) {
SqlMapIndexEntity indexEntity = (SqlMapIndexEntity) entity;
SqlMapSession sqlMapSession = getSqlMapClient().openSession();
try {
sqlMapSession.startTransaction();
if (log.isDebugEnabled()) {
log.debug(buildMessage("Indexing select statement id [" + indexEntity.getStatementId() + "]"));
}
sqlMapSession.queryWithRowHandler(indexEntity.getStatementId(), indexEntity.getParam(),
new SqlMapClientGpsDeviceRowHandler(indexEntity, session, pageSize));
session.evictAll();
sqlMapSession.commitTransaction();
} catch (SQLException e) {
throw new SqlMapGpsDeviceException("Failed to fetch paginated list for statement [" + indexEntity.getStatementId() + "]", e);
} finally {
try {
try {
sqlMapSession.endTransaction();
} catch (Exception e) {
log.warn(buildMessage("Failed to close sqlMap session, ignoring"), e);
}
} finally {
sqlMapSession.close();
}
}
}
}
}