Three years as a Hibernate Developer Advocate

Introduction

Three years ago, I started working as a Developer Advocate for the Hibernate team at Red Hat.

Each year, I write a new report to summarize the accomplishments for the Hibernate project and its community. If you’re curious about the previous year reports, check out the

Continue reading “Three years as a Hibernate Developer Advocate”

How to execute SQL functions with multiple parameters in a JPQL query with Hibernate

Introduction

In this article, we are going to see how you can execute SQL functions with multiple parameters in JPQL queries with Hibernate. I recently stumbled on this requirement while answering this StackOverflow question which is a never-ending source of inspiration for articles on my blog.

Continue reading “How to execute SQL functions with multiple parameters in a JPQL query with Hibernate”

How to map camelCase properties to snake_case column names with Hibernate

Introduction

In this article, you are going to learn how to map cameCase entity properties (e.g. phoneNumber) to snake_case column names (e.g. phone_number) using a Hibernate naming strategy.

While you could achieve the same goal with the name attribute of JPA @Column annotation, it’s much more convenient to use a custom Hibernate strategy to apply this naming convention consistently.

Continue reading “How to map camelCase properties to snake_case column names with Hibernate”

How to optimize JPQL and Criteria API query plans with Hibernate Statistics

Introduction

Every entity query, be it JPQL or Criteria API, needs to be parsed and compiled to an AST (Abstract Syntax Tree) in order to generate the associated SQL query. The entity query compilation takes time, as explained in this article so Hibernate provides a QueryPlanCache to store already-compiled plans.

Starting with Hibernate 5.4, the Hibernate Statistics object allows you to monitor the Query Plan Cache and this article will show you how to take advantage of this feature to speed up IN query performance.

Continue reading “How to optimize JPQL and Criteria API query plans with Hibernate Statistics”