Seize the deal!
You missed out!
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 pick of this edition is this article which shows you how MySQL stores data/time information in
DATETIME columns and how you can handle time zone information.
On the 23rd of May, Hibernate turned 20. To celebrate this anniversary, I wrote this article, in which I’m sharing my Hibernate journey.
If you’re using SQL Server, then you should learn how Foreign Key locking works, as it can impact concurrency if you include all the table columns during an UPDATE, which is how the default Hibernate UPDATE works. For more details about this topic and why you should use
@DynamicUpdate with SQL Server, then check out this article.
@DynamicUpdate, if you are using JSON columns, then you should also set the entity to use a dynamic UPDATE statement, as otherwise, the JSON column will be sent to the database on every property change, even if the JSON column hasn’t been modified. For more details, check out this article.
PostgreSQL 14 will add a new JSON path expression that will allow you to better locate nested attributes. For more details, check out this article.
RANDOM function in the
ORDER BY clause allows you to shuffle results. However, as explained in this article, the performance might not be great if the table is fairly large. So, if you’re using PostgreSQL, this article explains how you can emulate this feature using a spatial column that can have an associated
If you’re Spring Data JPA, then JPA Entity Graphs can be useful with
@Query methods. For more details about how JPA Entity Graphs work, you can read this article.
In my previous online workshop, I talked about the best way to store JSON data and how you can query it efficiently when using Oracle, SQL Server, PostgreSQL, and MySQL.
The workshop was recorded, and I’m editing the videos. So far, I managed to edit around 40 minutes of video lessons, and many more will be coming in the upcoming days.
Therefore, if you’re interested in the following topics:
JSON_TABLE, and Oracle JSON data indexing
OPENJSON, and SQL Server JSON data indexing
JSONBtypes, JSON path expressions, JSON operators, JSON functions, and PostgreSQL JSON data indexing
JSONtype, JSON path expressions, JSON operators, JSON functions, and MySQL JSON data indexing
Then, you should definitely join the SQL online workshop and watch the video lessons.
Here are the best tweets I posted since the last newsletter:
Frameworks come and go.— Vlad Mihalcea (@vlad_mihalcea) May 22, 2021
Relational databases stay.
Next time you debug your application step into the framework code to see how it works.— Vlad Mihalcea (@vlad_mihalcea) June 6, 2021
Not only that you'll understand the framework better, but you can discover new programming techniques as well.
Don't put work above your own health. Your career is a very long marathon, not a short sprint.— Vlad Mihalcea (@vlad_mihalcea) June 1, 2021
If you try and fail, be proud.— Vlad Mihalcea (@vlad_mihalcea) May 25, 2021
Most people won't even try.
If you are using Hibernate 5.4, then you might want to upgrade to the 5.4.32 version, which fixes several issues and add new improvements.
The 2.11 version of the Hibernate Types project has been released, and it provides a new
JsonType that works with PostgreSQL, MySQL, Oracle, SQL Server, and H2 without having to do any change in your mapping. With this improvement, you can address the portability issues of using DB-specific JSON columns.
If you’re using PostgreSQL, then you might be interested in the 13.3 release, which provides several bug fixes.
And, if you’re using MySQL, then check out the 8.0.25 release.
If you like this newsletter,
you are going to love the next episodes!
The following StackOverflow answers have been trending over the past two weeks:
date_trunc('day', (entity.date AT TIME ZONE 'UTC'))function when using JPA and Hibernate