How to map a JPA entity to a View or SQL query using Hibernate

Introduction In this article, you are going to learn how to map a JPA entity to the ResultSet of a SQL query using the @Subselect Hibernate-specific annotation.

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

Introduction Sergey Chupov asked me a very good question on Twitter: My use-case is a search by complex primary key, but the performance test still showed a degrade. I'm now using a query cache instead, which helps, but it doesn't look right to have a separate query for the search by PK. So I'm wondering if there's a better approach — Sergey Chupov (@scadgek) December 29, 2017 In this article, I’m going to show you how to cache null results when using JPA and Hibernate.

JDBC Driver Connection URL strings

Introduction Ever wanted to connect to a relational database using Java and didn’t know the URL connection string? Then, this article is surely going to help you from now on.

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.