【发布时间】:2018-06-07 19:29:41
【问题描述】:
我在我的 Java Spring MVC 应用程序中使用 Hibernate Query Language (HQL) 和 Oracle 数据库。我以这种方式编写了 HQL 更新查询:
String hql = "update " + MyModel.class.getName() + " e set e.field = " + value + " where ..."
//Acquiring session
...
Query query = session.createQuery(hql);
int result = query.executeUpdate();
executeUpdate() 方法返回更新的行数。但我想在执行更新查询后获取更新行的 id 列表。在 HQL 中有没有办法做到这一点?
【问题讨论】: