sc.setParameters("state", currentState);
sc.setParameters("updatedCount", templatePool.getUpdatedCount());
templatePool.incrUpdatedCount();
UpdateBuilder builder = getUpdateBuilder(vo);
builder.set(vo, "state", nextState);
builder.set(vo, "updated", new Date());
int rows = update((VMTemplateStoragePoolVO) vo, sc);
if (rows == 0 && s_logger.isDebugEnabled()) {
VMTemplateStoragePoolVO dbVol = findByIdIncludingRemoved(templatePool.getId());
if (dbVol != null) {