High-Performance Java Persistence Newsletter, Issue 6

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

Introduction

Welcome to a new issue of the High-Performance Java Persistence Newsletter in which we share articles, videos, workshops, and StackOverflow answers that are very relevant to any developer who interacts with a database system using Java.

Articles

The N+1 query issue is usually associated with ORM frameworks, but, in reality, this problem can happen with any data access framework. This article explains what the N+1 query issue is and how you can prevent it when using JPA and Hibernate.

If you’re using PostgreSQL, then you should definitely read this performance tuning article. You will learn how to find and generate the execution plan automatically for slow queries or find missing indexes.

The JPA SqlResultSetMapping allows you to customize the result set of a given JPQL or native SQL query. This article explains in great detail how the JPA SqlResultSetMapping works, as well as when you should use the associated EntityResult, ConstructorResult, and ColumnResult result set transformers.

When dealing with database performance issues, it’s very important to know how to read database statistics. If you’re using MySQL, you can query the mysql.innodb_table_stats and mysql.innodb_index_stats virtual tables and find if a table or index statistics are outdated. For more details about this topic, check out read this article by Percona.

In this article, Lukas Eder explains how the DISTINCT keyword works in SQL and why you shouldn’t treat it as a function.

Project releases

Hibernate ORM 5.4.13 has been released, and I’m very excited about this version since there are several improvements, which I also contributed, like HHH-13103, HHH-13853, and HHH-13872.

I released the 2.9.7 version of the Hibernate Types project, which fixes an issue related to JSON objects that triggered a redundant UPDATE statement when the Persistence Context is flushed. Also, array Hibernate Types now allow you to provide the underlying element type, which is sometimes needed when using the Hibernate addScalar method for native SQL queries.

If you like this newsletter,

you are going to love the next episodes!

StackOverflow Answers

The following StackOverflow answers have been trending over the past two weeks:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.