How to cache non-existing entity fetch results with JPA and Hibernate

Introduction

Sergey Chupov asked me a very good question on Twitter:

In this article, I’m going to show you how to cache null results when using JPA and Hibernate.

Continue reading “How to cache non-existing entity fetch results with JPA and Hibernate”

How to use the Hibernate Query Cache for DTO projections

Introduction

On the Hibernate forum, I noticed the following question which is about using the Hibernate Query Cache for storing DTO projections, not entities.

While caching JPQL queries which select entities is rather typical, caching DTO projections is a lesser-known feature of the Hibernate second-level Query Cache.

Continue reading “How to use the Hibernate Query Cache for DTO projections”