public void testSampleDomainQuery17() throws Exception {
QueryFactory qf = Search.getQueryFactory(remoteCache);
// all accounts for a user. first get the user by id and then get his account.
Query q1 = qf.from(User.class)
.having("id").eq(1).toBuilder().build();
List<User> users = q1.list();
Query q2 = qf.from(Account.class)
.orderBy("description", SortOrder.ASC)
.having("id").in(users.get(0).getAccountIds()).toBuilder().build();
List<Account> list = q2.list();
assertEquals(2, list.size());
assertEquals("John Doe's first bank account", list.get(0).getDescription());
assertEquals("John Doe's second bank account", list.get(1).getDescription());
}