私は従業員のリストを含むDepartmentエンティティを持っています。職員1から職員10の従業員リストをdepartmentAが持っているとします。ステップ2で、従業員のリストの下このシナリオでは、休止状態はどのように機能しますか?
Step 1
Department dept=(Department)session.get(Department.class, 100); // Department A
Step 2
List<Employee> employees = dept.getEmployees();// it contains employee 1 also
Now get employee for id1 from above list and modify the address to address 2
Step 3
Employee emp_step_3=(Employee)session.get(Employee.class, 1);
//updates employee address address 3 with session.saveOrUpdate(emp_step_3);
Step 4
session.saveOrUpdate(dept);
質問
- ウィル従業員1オブジェクトがemp_step_3と同じになりますか?
- 手順2で既にフェッチされているため、従業員ID 1の手順3でクエリを実行する必要がありますか?
- 従業員1の住所2または3を更新する必要がありますか?
FYI、私はステップ2で、従業員のリストの下にあるすべての団体
DepartmentとEmployeeのオブジェクトを共有できますか?これはあなたの質問に答えるのを助けます...うまくいけば。 –