When building a Predicate for the Entity Book, I would like to be able to left join on Category (ManyToMany) to add a AND Predicate on Category. I could simply achieve that if I have the JPAQuery instance :
if (catId != null) {
jpaQuery.leftJoin(book.categories, category);
jpaQuery.where(category.id.eq(catId).or(category.parentCategory.id.eq(catId)));
}
But when building Predicates I don't have yet the JPAQuery. So for the Predicate itself I could do :
booleanBuilder.and(category.id.eq(this.categoryId).or(category.parentCategory.id.eq(this.categoryId)));
But for the leftjoin how to proceed without the jpaQuery instance ?