Hi,
I've used the composition pattern to define a virtual file system:
Code:
@Entity
public class VirtualFolder extends VirtualFile {
@Composition
@OneToMany(mappedBy="folder", cascade = CascadeType.ALL, fetch=FetchType.EAGER)
private Set<VirtualFile> contents = new HashSet<VirtualFile>();
if I now load the root folder with
Code:
session.createCriteria(VirtualRootFolder.class).uniqueResult();
I get the whole tree of all sub folders and sub sub sub folders.. but I only want one level, not all. If I remove the fetch annotation and define the fetch strategie in the criteria, I get the result I wanted:
Code:
session.createCriteria(VirtualRootFolder.class).setFetchMode("contents", FetchMode.JOIN).uniqueResult();
Is there a way to define the same behaviour by annotations?
Best regards
Sebastian Baltes