We recently updated to Hibernate 4.3.7 (before 4.3.6). Since this update we have problems fetching an entity with an association where we also have a restriction on the elements of a collection inside this association. The entities we use are:
Code:
@Entity
public class Office {
    String id;
    String officeCode;
    @ManyToOne(fetch = FetchType.LAZY)
    Participant participant; 
   ...
}
@Entity
public class Participant {
   String id;
   String code;
   @OneToMany(fetch = FetchType.LAZY)
   Set<Translation> translations;
   
   ....
}
@Entity
public class Translation {
   private String description;
   private Language language;
   
   ...
}
We use jpa criteria for finding all offices with participants that have translations in a certain language:
Code:
CriteriaQuery<Office> criteriaQuery = entityManager.getCriteriaBuilder().createQuery(Office.class);
Root<Office> office = criteriaQuery.from(Office.class);
office.fetch(Office_.participant);
Predicate predicate =entityManager.getCriteriaBuilder().equal(office.join(Office_.participant).join(Participant_.translations).get(Translation_.language), language);
criteriaQuery.where(predicate);
List<Office> results=entityManager.createQuery(criteriaQuery).getResultList();
When we execute this query, the participant is not fetched, while in Hibernate 4.3.6 it is. How can we fetch these kind of associations?