我有 2 个实体作为父和子作为 OneToMany 关系
@Entity
public class Parent {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String name;
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY)
@IndexColumn(name = "index", base = 1)
@Cascade(org.hibernate.annotations.CascadeType.ALL)
@LazyCollection(LazyCollectionOption.EXTRA)
private List<Child> childs = new ArrayList<Child>();
// getter and setter
}
那么这里@LazyCollection(LazyCollectionOption.EXTRA)的用途是什么,它什么时候会出现,比如对于子列表的哪个操作,这将是有益的?