High-Performance Java Persistence Newsletter, Issue 6
Imagine having a tool that can automatically detect JPA and Hibernate performance issues. Hypersistence Optimizer is that tool!
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.
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.
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
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_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.
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.
Get in touch with my latest articles!
The following StackOverflow answers have been trending over the past two weeks:
- What is the N+1 selects problem in Object-Relational Mapping?
- Can you have multiple transactions within one Hibernate Session?
- How to map the result set of a JPA NativeQuery to a POJO using
- How does JPA orphanRemoval=true differ from the ON DELETE CASCADE DML clause
- How do synchronized static methods work in Java, and can I use it for loading Hibernate entities?
- How to use Space in column name with JPA and Hibernate