Sorry, let me try to explain myself a little bit better. This is essentailly my expectations:
A1 has a collection B1
A2 has a Collection B2
B1 contains B_B1, B_B2, B_B3
B2 contains B_B5
B_B1 Points to Q1, B_B2->Q2 and B_B3->Q3.
If I evict A1 (and it's collections), shouldn't A1, B1, and Q1, Q2, Q3 all be Evicted from the cache. So, not the entire cache region, but just the associated values.
So for a more concrete example (all set to be cachable):
Parent.id=1 that has a collection of
child.id=1, child.id=2, child.id=3.
Parent.id=2 that has a collection of
child.id=2, child.id=4, child.id.5
In hibernate's cache stats, I will see 3 regions:
Parent, Parent.Child, and Child.
In the above example, Parent.id=1 and Parent.id=2 share Child.id=2.
There are 2 things which I don't understand going on:
1) If you set Cascade=evict on the Parent.Child collection in the mapping file, why does:
SessionFactory.evict(Parent.id=1), not evict Parent.Child where Parent.id=1
2) If you do SessionFactory.evictCollection(Parent.child, id=parent.id=1) why does:
Parent.Child.id=1, parent.Child.id=2, and Parent.Child.id=3 (the parent's collection) is evicted from the cache. But why isn't Child.id=1, Child.id=2, and Child.id=3 NOT evicted.
Still left in the cache SHOULD be:
It is my understanding that if cascade=evict (or as the documentation states, should be set to "all" or "all-delete-orphan"), on the parent's collections, the associated collections will be evicted. On top of that, since the associated collections, are really pointers to another entity in the cache, those should be evicted as well. Not the entire cache region, but just the ones associated.
Hope that helps explain myself better...
[ August 18, 2006: Message edited by: Jonathan Huang ]