Chapter 5. Hibernate Cache

In this chapter, we will discuss various topics on Hibernate caching. One of the advantages of using Hibernate is its ability to cache entities to minimize trips to the database. Of course, to take advantage of this feature correctly, one must be fully aware of the pitfalls. For example, if you cache entities that can be updated by another application, then your cache may be invalid. In this chapter, we will discuss various cache levels, how to enable cache, strategies, and more:

  • Cache structure:
    • Cache scope
    • First-level cache
    • Second-level cache
    • Query cache
  • Caching benefits and pitfalls
  • Caching strategies:
    • Read only
    • Non-strict read write
    • Read write
    • Transactional
    • Object identity
  • Managing cache:
    • Remove cached entities
    • Cache modes
  • Cache ...

Get Mastering Hibernate now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.