Home How to force hibernate not to load subentities
 I have A and B entities where A can have more Bs @Entity @Table(name = "A") public class A { @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name = "b_id", nullable = false, insertable = true, updatable = false) private Set bs; }  what I need is to say jpa somehow not to load set of Bs in special situations. I tried it other way around, I defined fetch = FetchType.Lazy and then I say hibernate when i want to load B. Problem is however, that when i do a.getBs(), hibernate loads the bs even when i dont want this behaviour ( I wanted only check if B is loaded or not). It means I need to force hibernate with jpa not to load subentities later (a.getBs()) with lazy load mode OR to force not to load entities with eager load mode. In jpa there is method Root.fetch(). I would need Root.unfetch()