Say I have 3 collections:
User
User_Role
Role
I want to know a user by given role name but I need to join user_role on user.id and user_role on role.id to establish the user. Currently all the samples only demonstrate how to do a join with two collections, i.e.
Query<Car> carsQuery = and(
in(Car.FEATURES, "sunroof", "convertible"),
existsIn(garages,
Car.NAME,
Garage.BRANDS_SERVICED,
equal(Garage.LOCATION, "Dublin")
)
);
How do I create a query to get ResultSet<Role>
from a given User user
?
This is what I have so far but I'm getting no suitable method found for and(Query<User>,Query<Role>,Equal<Role,String>)
String ROLE_NAME = "tester";
Query<User> query = and(
existsIn(user_roles,
(Attribute<User, String>) (Object) User.ID_INDEX,
User_Role.USER_ID_INDEX
),
existsIn(user_roles,
(Attribute<Role, String>) (Object) Role.ID_INDEX,
User_Role.ROLE_ID_INDEX
),
equal(Role.NAME_INDEX, ROLE_NAME.toUpperCase())
);