Hibernate; HQL; why does the delete query not work, but select does?

I want to delete certain records from a table. These records have some child-records in other tables. In order to be able to delete the main records, I have to delete the child records first. Here is the example of the HQL used: delete from ItineraryBooking ib where ib.booking.user.id = :paramId Basically, this should remove all ItineraryBookings (records in seperate table), these are joined to the Booking table. A Booking table can be joined with the User table. The odd thing is that when you change the above to: from ItineraryBooking ib where ib.booking.user.id = :paramId And execute a Query.list(), it will work just fine. Whenever I want to execute the delete variant, it looks like Hibernate generates an odd delete statement. Is my HQL wrong? Or is it a Hibernate quirk?

以上就是Hibernate; HQL; why does the delete query not work, but select does?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏