try(Session session = sessionFactory.openSession()) {
session.beginTransaction();
String hql = "update EmployeeTask set employee = 1 where employee is null";
session.createQuery(hql, EmployeeTask.class).executeUpdate();
session.getTransaction().commit();
}
抛出以下内容
原因:org.hibernate.query.IllegalQueryOperationException:为非SELECT查询指定的结果类型[update EmployeeTask set employee = 1,其中employee为null]
我希望“employee”列中当前为空的所有值都将具有值1
1条答案
按热度按时间lxkprmvk1#
看看文件。执行更新或删除语句。* @返回更新或删除的实体个数