I find this pretty confusing, but I think this is going on:
1) I use a query to get an object A.
2) Object A has a collection of B's.
3) I use a different query to get a collection B's. This query is setup for caching.
4) I repeat step 3), expecting to get back the cached query results. But I don't. I took a look and think the problem is that when my query in step 4 executes, a Flush occurs. Now this Flush checks the "removeCollections" and for some reason the collection of B's on my A object is causing an invalidation to the query cache for the B's table. Well I have not changed the collection of B's on the A, so i don't see why the B's are getting invalidated. It seems just by virtue of there being a Persister on the collection, invalidation occurs.
Does this scenario seem plausible? I switched to using a readonly cache for the collection of B's on the A, and then got an exception. But nothing is modifying this collection so why would that occur?
Thanks,
JP
|