Can multiple joins be a condition?
final CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<Game> query = builder.createQuery(Game.class);
final Root<Game> game = query.from(Game.class);
final ListJoin<Game, Store> store = game.join(Game_.stores);
final ListJoin<Game, Category> category = game.join(Game_.categories);
the second join (catetory) makes results different even if there is no predicates with it.
what’s wrong with this code?
The join is an inner join by default. So the query will only select the games that have at least 1 category. Make it a left join, and it will select all the games (even those which don’t have any category).