I'm using @OneToMany feature, with FetchType.EAGER set. But JPA (through EclipseLink) keep making one sub request for each sub object in my list. I really dont get why. I follow many thread I found, but cant make this select work in one single request.
Also, I retrive my object with CriteriaBuilder, CriteriaQuery and some Predicate. This may be an issue ? Anyway, all this filter are only use for the top lvl classes. I still want the lower one to be fetched as well.
My entities look like :
@Entity
@Table(name = "mainTable")
public class MainTable extends SqlEntity {
@OneToMany(fetch = FetchType.EAGER)
private List<MainLocation> locations = new ArrayList<MainLocation>();
...
}
@Entity
@Table(name = "mainLocation")
public class MainLocation extends SqlEntity {
@OneToMany(fetch = FetchType.EAGER)
private List<MainDetail> details = new ArrayList<MainDetail>();
...
}
@Entity
@Table(name = "mainDetail")
public class MainDetail extends SqlEntity {
...
}