can anyone help me understand the bidirectional association in a many-to-one relationship?
I have an employee who works at a division (many employees work at A division)
I want to map the FK of divisionID to the employee:
Code:
<class
name = "Employee"
...
<many-to-one
name = "division"
column = "DIVISION_ID"
class = "Division"
not-null = "true" />
now in division I want to have a set of employees who work there:
Code:
name="Division"
...
<set
name = "employees"
inverse = "true"
cascade = "all" >
<key column = "SSN"/>
<one-to-many class = "Division" />
/>
I got this structure from a hibernate book and I wanted to make sure that certain things happen.
Lets say I delete an employee, will it delete it from the set of employees in the divisions table?
Lets say I change where an employee works, will it delete it from the set of employees in the division table and update the appropriate division's set?
Let's say I do the same things as above but from the Division's set will it be updated in the employee table?
Any help would be great. I haevn't implemented it yet so sorry if this is not very specific.