I know this question refers to the earliest stages of database theory, but I have not encountered such a problem since several months. If someone has a database with some tables linked together as a “chain” with foreign keys, and they want to delete a record from a table with some “dependent” tables, what are the obstacles? In particular, associations exist in the database with tables: Person, Profile, Preference, Filter, because Person.id is a foreign key in Profile and Profile.id is a foreign key in Preference and Filter.id is a foreign key in Preference , so that’s all the enter code here associations are equal to OneToMany . Is it possible to remove Person with a simple query:
Delete from Person p where p.id= 34;
If not, what should the request look like to successfully complete the deletion? If the database in the application is hibernated, what annotations should be applied to the associated fields of each object in order to be able to perform deletion with a simple simple query?
source share