I have a problem. I have a domain that has child data. I can easily delete it by using Cascade delete but my teacher said that I must not cascade it. My plan is when the data has associations I will retrieve the associated and show it to the user. So far what I have is catching it by using try catch and I can display it on eclipse console. The display is:
java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (
EPS.
EMPLOYEE_EMPLOYER, CONSTRAINT
FK_EMPLOYEE_EMPLOYER_EMPLOYEEFOREIGN KEY (
EMPLOYEE_ID) REFERENCES
EMPLOYEE(
EMPLOYEE_ID))
Since it throws an ajax error I did an alert that says You cannot delete this record because it has associated record/s.
. I want to be more specific.
Then I don't know what to do next. I want to retrieve all associated data and display it. Please help.