You should set the entire department.
Load the Department with id 1 into a object ("department") and assign it to the variable (st.department = department).
That should be the way to go, the way your doing it, your altering the id of the department of that staff, not assigning department with id 1.
You may use a workaround, use
<many-to-one name="Department" column="DepartmentID " update="false" insert="false"/>
only as the reference of the object and a
<property name="DepartmentID" column="DepartmentID" type="int" not-null="true" />
to access directly the column of staff (and altering the getters/setters to keep them pointing to the same department), but you should use the first option.
;)
|