How to JOIN unrelated entities with JPA and Hibernate

Introduction

Answering questions on the Hibernate forum is a neverending source of inspiration. The following question is about joining unrelated entities using entity queries, and this post is going to explain how you can do it when using JPA and Hibernate.

Continue reading “How to JOIN unrelated entities with JPA and Hibernate”

Advertisements

How do solve the PostgreSQL :: cast operator issue with JPA and Hibernate

Introduction

While answering questions on the Hibernate forum, I stumbled on the following question, and, since it’s very interesting, I decided to turn the answer into a dedicated blog post.

Continue reading “How do solve the PostgreSQL :: cast operator issue with JPA and Hibernate”

The best way to map an Enum Type with JPA and Hibernate

Introduction

Recently, I got a very good question on Twitter, and I decided that the best way to answer it is with a new article.

In this article, we are going to see how various ways to map an Enum using JPA and Hibernate.

Continue reading “The best way to map an Enum Type with JPA and Hibernate”

The best way to fix the Hibernate “HHH000104: firstResult/maxResults specified with collection fetch; applying in memory!” warning message

Introduction

If you’ve been using Hibernate long enough, then you surely must have seen this WARN log message when doing pagination while join fetching multiple entities.

HHH000104: firstResult/maxResults specified with collection fetch; applying in memory!

In this article, I’m going to show a very elegant solution to fix this issue.

Continue reading “The best way to fix the Hibernate “HHH000104: firstResult/maxResults specified with collection fetch; applying in memory!” warning message”