Hello All
I have an entity called country which has a collection of State objects mapped to it using one-to-many. For the cache test I disabled lazy loading.
For testing second level cache (SysCache implementation) I have written a small program that do the following process twice for the same state:
1. create a session
2. load the country using session.load()
3. Iterate over the states and pring them
I expected that in the second time I do this action all the relevant data will be read from the cache.
In fact, what happens is that only the country itself is found in the cache while the states are re-read from the database.
Looking at the log I see that during the first time the data is read both the country and the states are saved in the cache but in the second time I get a cache hit only for the country and it looks like the states are added to the cache once again.
I read about cache in query or load operation, but what is the behavior when initializing collections?
Thanks In Advance
Dror
|