Hello,
I'm wondering about second level cache: I'm trying to activate it and to see the performance after execution with cache. I think that a first level cache is associated to a session, and the second one is associated to the session Factory...
So, i have done necessary configurations in order to activate the second level cache, and i think it's ok and it's runing: this is the content of the region of my Customer class:
Code:
SecondLevelCacheStatistics[hitCount=0,missCount=0,putCount=3097,elementCountInMemory=3097,elementCountOnDisk=0,sizeInMemory=4923969]
when i'm executing the same function "getCustomers" for the second time, in the same session, it doesn't generate all queries associated to collections, what is what i want, but i was surprised when i desactivate the cache, it do the same thing=> i deduced that it was the first level cache which was runing...
For this reason, i closed the session but still in the same sessionFactory, i execute the function "getCustomers()" and now it doesn't read from cache even, my second level is containing all data i want.... I put here the content if the statistic after:
1- executing 3 times the function ,
2-closing the session
3-Statistics are:
Code:
Statistics[start time=1228834340015,sessions opened=2,sessions closed=1,transactions=0,successful transactions=0,optimistic lock failures=0,flushes=0,connections obtained=3,statements prepared=3750,statements closed=3750,second level cache puts=8130,second level cache hits=0,second level cache misses=3747,entities loaded=4408,entities updated=0,entities inserted=0,entities deleted=0,entities fetched=25,collections loaded=3722,collections updated=0,collections removed=0,collections recreated=0,collections fetched=3722,queries executed to database=3,query cache puts=0,query cache hits=0,query cache misses=0,max query time=27812]
4- the call to the function leads to the execution of n+1 select to bring all collections....
Could you explain me please, what is wrong?
Thank you for help