컬렉션의 각 하위가 EclipseLink에 의해 개별적으로로드되는 방식이 있습니까?JPA/EclipseLink로 지연로드 모음
내가 두 엔티티 가지고있다 :
@Entity
public class A {
private List<Item> collection = new LinkedList<Item>();
@OneToMany(fetch = FetchType.LAZY)
public List<Item> getCollection() {
return this.collection;
}
public void setCollection (List<Item> collection) {
this.collection = collection;
}
}
@Entity
public class Item {
private byte[] data;
@Lob
public byte[] getData() {
return data;
}
public void setData(byte[] data) {
this.data = data;
}
}
내 컬렉션에 많은 수의 항목을 포함을, 따라서 나는 예를 들어, 액세스 할 때 모든 아이를로드하기 위해서 (때문에)는 EclipseLink를 원하지 않는다 첫 번째 항목 만 그러나 a.getCollection(). get (0) .getData()을 호출하면 컬렉션의 모든 항목이 메모리에로드됩니다. 이것을 피할 수있는 방법이 있습니까?