Hibernate HQL; Why does the delete request not work, but select?

I want to delete specific records from a table. These records have some child records in other tables.

To delete master records, you must first delete the child records.

Here is an example of the HQL used:

delete from ItineraryBooking ib where ib.booking.user.id = :paramId

In principle, this should delete all route lists (entries in a separate table), they are attached to the reservation table. The reservation table may be connected to the user table.

The strange thing is that when you change above:

from ItineraryBooking ib where ib.booking.user.id = :paramId

And do Query.list (), it will work fine.

Whenever I want to execute a delete option, it looks like Hibernate is generating an odd delete instruction. Is my HQL wrong? Or is it a sleeping quirk?

+5
2

hibernate manual:

, , HQL. where-where, .

ib.booking.user.id . , Hibernate delete .

- .

+7

, :

  • , HQL ? selects , .

  • HQL?

  • ?

0

All Articles