Get children for any level in tree structure but without theirs children using Hibernate?

@Table(name = "folders")
public class Folder {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "folder_id", unique = true, nullable = false)
    private int id;

    @Column(name = "name", length = 100, unique = true, nullable = false)
    private String name;

    @OneToMany(fetch = FetchType.EAGER, mappedBy = "parent", orphanRemoval = true)
    @Column(name = "sub_folders")
    private Set<Folder> childFolders = new HashSet<>();

    @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    @JoinColumn(name = "parent", referencedColumnName = "folder_id", nullable = true)
    private Folder parent;

    public Folder() {


I'm trying to write a finder method or custom query which will do what I wrote in the subject.

So if I send a request going like folders/{parent_folder_id}, let's say value being 1, I should get objects 4 and 5, but without their children, so not including 6,7,8 and 9.

Ideally, hibernate query would be preferred. If not, any sql language is also fine. I'll try to tumble it up to hibernate.

This is what I got, I still get children...