We already saw how caching works in Spring in Chapter 3, Tuning Aspect-Oriented Programming. Here, we will see how caching works in Hibernate, and what different types of caching are available in Hibernate. In Hibernate, there are three different types of caching, as follows:
- First level cache
- Second level cache
- Query cache
Let's understand how each cache mechanism works in Hibernate.