hi
I'm pretty unexperienced with Hibernate and I'm trying to understand how hibernate query cache really works. I have a persistent entity called Container which can have many Items. I wanted to have all the items cached: 
Code:
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
class Item { 
  // the code ... 
}
class Container { 
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  public List<Item> getItems() { ... } 
  
  // rest of the code ...
}
The problem which I have noticed is that when I:
1) read some Containers from the db into memory (together with the corresponding items)
Code:
       String hql = 
          "from Container c left join fetch c.items where c.type = 1";
       List<Item> list = hibernateTemplate.find(hql);
2) insert new Item for a chosen Container 
Code:
       hibernateTemplate.save(item)
3) repeat the first step 
then in the 3rd step I cannot see the item I have inserted in the second step.
The only way I have found to make it work was to manually clean the cache after inserting new items:
Code:
  sessionFactory.evictCollection("Container.items", updatedContainerId)
My gut feeling tells me that Hibernate should do such a cache invalidation automatically. Has anyone seen it working? Am I doing something wrong or is it just not supported?
Thanks in advance for the answer.
Greetings
  Tom