Using a join in a Hibernate HQL update query

旧城冷巷雨未停 提交于 2019-12-03 10:43:25

You have to use subquery instead of join. Roughly as follows:

UPDATE Roomreservation as rr set rr.FromTime= 12:15
WHERE rr.Book_ID IN (
  SELECT b.id 
  FROM Booking b 
  WHERE b.id = 95637);

Additionally depending about type of FromTime it is likely that it should be presented in some other format.

This missing single quote for rr.FromTime= '12:15' should be the error.

String hql = "UPDATE Roomreservation as rr set rr.FromTime= '12:15' " +
"Inner Join Booking b ON rr.Book_ID= b.ID " +
"Where b.ID = 95637";

Can you please check this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!