Vlad Mihalcea

The best way to initialize LAZY entity and collection proxies with JPA and Hibernate

Introduction

In this article, we are going to see the best way to initialize LAZY proxies and collections when using JPA and Hibernate.

I decided to write this article because there are way too many resources available on the Internet that mislead the reader into using awkward and inefficient practices.

Read More

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

Read More

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.

Read More

The best way to use the JPQL DISTINCT keyword with JPA and Hibernate

Introduction

In this article, we are going to how the JPQL DISTINCT keyword behaves depending on the underlying entity query type.

Read More

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.

Read More

New Video Course