I have two entities:
public class Employee {
| ...
| @ManyToOne
| public Organization getPlaceOfWork() {
| return placeOfWork;
| }
| public void setPlaceOfWork(Organization placeOfWork) {
| this.placeOfWork = placeOfWork;
| if(placeOfWork!=null){
| placeOfWork.getEmployees().add(this);
| }
| }
|
| }
|
| public class Organization {
| ...
| @OneToMany(fetch=FetchType.EAGER, mappedBy="placeOfWork")
| public Collection<Employee> getEmployees() {
| return employees;
| }
| public void setEmployees(Collection<Employee> employees) {
| this.employees = employees;
| }
| }
How can I cause Employees to be set their placeOfWork to null when Organization is removed
(like database cascade)? And what should I do, if I want to delete Employees when
Organization is removed?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972723#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...