【发布时间】:2015-04-25 11:25:16
【问题描述】:
我正在阅读用户 @JB Nizet 的帖子
Hibernate Exception on MySQL Cross Join Query
后来我尝试了自己的代码
我有这样的 HQL。
update Student set newField='newField',anotherFieldsToBeUpdated where ....
and id in
(select s.id from Student s where s.school=:school)
-->[Student->School]many to one relationship....
但还是扔了臭名昭著的
Caused by: java.sql.SQLException: You can't specify target table 'Student' for update in FROM clause
我想知道是否仍然存在没有using another different select 或使用a temporal table 的解决方案。
【问题讨论】:
-
您能用文字说出您的查询目的是什么吗?学生和学校是什么关系?
标签: java mysql hibernate hql named-query