比方說,我有一個關聯作爲,是否FetchType.LAZY獲取列表中的任何東西,或它是空
class Department{
......
@OneToMany(fetch = FetchType.LAZY)
private List<Employee> employees;
}
現在,當我取Department
,將它取employees list
任何東西,或將其完全排空。
將爲員工對象標識符在列表中加載喜歡說我有員工對象,如下屬性: -
Employee{
id
name
doj
....
}
Lazy object like {
id -> 111
name -> null
doj -> null
}
現在,當我初始化Employee對象或訪問它的使用干將性質,那麼對象將被載入從數據庫使用ID作爲標識符...?
你可以嘗試一下,看看。 –