[CXF-5731] Optimizing joins in JPA queries, patch from Romain Castan applied