High-Performance Java Persistence Newsletter, Issue 10
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 amazing PostgreSQL internals list of resources written by Hironobu Suzuki. Although the PostgreSQL documentation is one of the best on the market, Hironobu Suzuki’s articles provide lots of details that had aren’t covered by the official manual.
A JPA entity needs to define an identifier attribute, whose value can be assigned either manually by the application or generated automatically by the JPA provider. To generate identifier values automatically, you have multiple options. You can use an IDENTITY column, o database sequence object. Since many relational database systems offer both IDENTITY columns and database sequences, it’s important to know which one works better with JPA and Hibernate. For more details about this topic, check out this article.
MUX published a very good article about using ClickHouse for analytics queries instead of the PostgreSQL extension offered by Citus.
PostgreSQL has been offering a JSON column type for a very long time, and this storage option is very useful when you need to store unstructured data coming from external systems. If you want to learn more about PostgreSQL JSON queries, check out this article.
JPA and Hibernate make it very easy to fetch graphs of entities via JPQL. However, if you want to fetch a read-only projection, you are better off using DTO projections. If the SQL projection contains a one-to-many relationship, then you can transform the tabular-based result set into a graph of DTOs using the Hibernate
ResultTransformer. If you want to learn more about this topic, check out this article.
If you are moving from Oracle to PostgreSQL or the other way around, you might bump into all sorts of issues caused by database-specific features that are not supported by both of these two relational database systems. This article helps you find these differences and what alternatives you can use for some database-specific features.
The online workshop was a blast. We had almost 170 participants, and I’m looking forward to doing a sequel.
I managed to release the 2.9.10 version of the amazing Hibernate Types project. If you’re using Hibernate, you should definitely use Hibernate Types as well.
Spring Data Neumann has been released. One of the most important changes is the inclusion of Spring Data R2DBC (which allows you to build reactive applications using relational database systems) in the main Spring Data release train.
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:
- What’s the difference between JPA and Spring Data JPA?
- When and why JPA entities should implement the
- How to fetch
FetchType.LAZYassociations with JPA and Hibernate in a Spring Controller
- How to convert a JPA
OneToManyrelationship to DTO
- What’s the difference between One-to-Many, Many-to-One, and Many-to-Many JPA relationships?
- What are the First and Second Level caches in Hibernate?
- How to set a default entity property value with JPA and Hibernate