This is not a technical question but rather about the right logic on handling delete with foreign key constraint. In my exercise app, I cascaded the record with OneToMany relationship with other records. In other words when I delete the record, Hibernate will automatically delete the associated records.
My problem is, my teacher told me that cascading is not right. He said that the user must delete first the associated records and he didn't tell me the details and he is kinda angry when he told us. (I don't know what's his problem but I don't really mind. I just want to learn).
Please give me some advice because I cannot make up my mind. So far these are my thoughts:
1) After clicking delete, the system will tell the user that there are associated records and it will be deleted along if he continues. He will be then ask if he will continue.
2) After clicking delete, the system will tell the user that there are associated records and he can be redirected to a page or there is a pop-up that will show all the associated records and he can manually delete.
3) Don't allow the user to delete.