public Object doInHibernate(Session session) {
// PENDING: can't hibernate figure this out on its own?
// First delete all trials
List<?> trialIds = session.createQuery("select id from TrialImpl trial where trial.session.module.id = :id").setParameter("id", moduleInfo.getId()).list();
for (Object o : trialIds) {
TrialImpl trial = new TrialImpl();
session.load(trial, (Long)o);
session.delete(trial);
//session.createQuery("delete TrialImpl trial where trial.id = :id").setParameter("id", o).executeUpdate();
}
session.flush();