• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object not getting picked from second level cache in hibernate?

 
scott miles
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i specified the below properties in cfg file.

In my main1 program i create the person with id 1 and commited and made that thread on hold after commit. Then i start the another thread T2 which is getting ther person with id 1 with below code


when T2 passed above statement, it generate the below query in background


I am not sure why thread T2 reading from database instead of getting it from second level cache as i am using usage as read-write ?

My Mapping looks like



 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can check whether the object is available in the second level cache by using given methods from the SessionFactory's getStatistics() method? (SecondLevelCacheStatistics.getEntries())
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic