I use JPA Criteria API to create a query:
List<Area> areas = areaService.getAreasForUser(user);
Join<Equipment, Area> areaJoin = equipment.join(Equipment_.area);
wheres.add(areaJoin.get(Area_.id).in(areas));
Which means I want to get all Areas where a User has access.
In a User has Areas it will evaluate to ... where area.id IN (1, 2, 3) which works fine.
When a User has no Areas it evaluates to: ... where area.id IN () which will result as error.
Can you give me a tip how to solve this problem?
Thanks