I have master-detail composition entities that I am trying to delete programmatically but getting the following exception.
PSQLException: ERROR: update or delete on table "erp_plan_order" violates foreign key constraint "fk_erp_plan_order_line_on_plan_order" on table "erp_plan_order_line" Detail: Key (id)=(fbd75c37-7f4b-e5bd-add1-e7eab75b2b63) is still referenced from table "erp_plan_order_line".
In the Parent entity structure (PlanOrder), CASCADE DELETE:
Probably your entities are not soft-deleted. In this case, the @OnDelete annotation affects only the generation of foreign key constraints for cascading on the database level. Check if the FK constraint has the on delete cascade clause.