How to simultaneously fetch multiple bags with hibernate

JPA specification allows up to two simultaneous eager fetches. But sometimes when we really need to this – we are stuck. One way to achieve this is to use hibernate extensions. We could do something like this: @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "keys") @Fetch(value = FetchMode.SUBSELECT)private List<T> keys; Second line instruct hibernate […]