Bug 350 : Query Cache not invalidated properly when not using bean cache
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.7.3
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
25/01/2011
Updated 
25/01/2011
Type 
Bug
 
Attachments 
No attachments

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.

 
woResponse

Upload a file