@Overridepublic void cancelTask(List<DeviceTask> deviceTasks) {
String ids = "";
for (DeviceTask deviceTask : deviceTasks) {
ids += deviceTask.getId() + ",";
}
Session session = null;
try {
session = getSession();
Transaction tx = (Transaction) session.beginTransaction();
String hqlUpdate = "update DeviceTask dt set dt.done =true ,dt.taskStatus = 6 " +
" where dt.activate =true and dt.done=false and dt.id in ("+ids+")";
int updatedEntities = session.createQuery(hqlUpdate)
.executeUpdate();
tx.commit();
} catch (RollbackException e) {
e.printStackTrace();
} catch (HeuristicMixedException e) {
e.printStackTrace();
} catch (HeuristicRollbackException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
} finally {
session.close();
}
}
برچسب:
نویسنده: خنج