If I run the following code:
User admin = new User();
server.save(admin);
admin=server.find(User.class).setId(admin.getId()).findUnique();
Account account = new Account();
account.setUser(admin);
server.save(account);
List accounts=
server.find(Account.class)
.setUseQueryCache(true)
.where().eq("user", admin).findList();
System.out.println("Number of accounts: "+accounts.size());
account = new Account();
account.setUser(admin);
server.save(account);
accounts=server.find(Account.class)
.setUseQueryCache(true)
.where().eq("user", admin).findList();
System.out.println("Number of accounts: "+accounts.size());
I obtain as result
Number of accounts: 1
Number of accounts: 1
instead of
Number of accounts: 1
Number of accounts: 2
It seems that the query in the cache has not been invalidated by
the change to the underlying table Account.
Thank you.