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 resultNumber of accounts: 1Number of accounts: 1
instead ofNumber of accounts: 1Number of accounts: 2
It seems that the query in the cache has not been invalidated bythe change to the underlying table Account.
Thank you.