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 Area
s where a User
has access.
In a User
has Area
s it will evaluate to ... where area.id IN (1, 2, 3)
which works fine.
When a User
has no Area
s it evaluates to: ... where area.id IN ()
which will result as error.
Can you give me a tip how to solve this problem?
Thanks