O'Reilly logo

Mastering Hibernate by Ramin Rad

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required