I was looking for an answer, but I could not understand it correctly. What is the difference between CascadeType.ALL , cascade = CascadeType.REMOVE , orphanRemoval when we set the FetchType.EAGER to @OneToMany ? As soon as I had a problem when deleting records. I used the following
@OneToMany(cascade = CascadeType.ALL, mappedBy = "companyEntity", fetch = FetchType.EAGER) Set<EmployeeEntity> employeeEntities;
When I tried to delete the Employee record, it did not show me any exceptions and did not delete the record. But when I changed CascadeType.ALL to CascadeType.REMOVE , then it worked. Why didn't he work with CascadeType.ALL rather with CascadeType.REMOVE ?
Thanks for the simple explanation in advance;)
source share