Vlad Mihalcea

PostgreSQL triggers and isolation levels

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

Introduction

In this article, we are going to see how the PostgreSQL isolation levels guarantee read and write consistency when executing database triggers.

While relational database systems provide strong data integrity guarantees, it’s very important to understand how the underlying transactional engine works in order to choose the right design for your data access layer.
Read More

How to map a PostgreSQL ARRAY to a Java List with JPA and Hibernate

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

Introduction

In this article, I’m going to show you how to map PostgreSQL ARRAY column types (e.g., text, int, double, enum, date, timestamp, UUID) to Java List entity attributes with JPA and Hibernate.

While the Hibernate Types project has been supporting PostgreSQL ARRAY column types since the very first version, prior to version 2.9, you could only map database ARRAY columns to Java Array entity attributes, as illustrated by this article.

Mapping database ARRAY columns to java.util.List entity attributes is a much better approach than using the previous Java Array option since, most often, it’s more convenient to use Java Collections than Arrays.

Read More

Java and Database Newsletter, Issue 2

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 Java and Database newsletter in which we share articles, announcements, and StackOverflow answers that are very relevant to any developer who interacts with a database system from Java.

Read More

SQL EXISTS and NOT EXISTS

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

Introduction

In this article, we are going to see how the SQL EXISTS operator works and when you should use it.

Although the EXISTS operator has been available since SQL:86, the very first edition of the SQL Standard, I found that there are still many application developers who don’t realize how powerful SQL subquery expressions really are when it comes to filtering a given table based on a condition evaluated on a different table.

Read More

How to return a Map result from a JPA or Hibernate query

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

Introduction

In this article, I’m going to show you how you can return a Java Map result when executing a JPA query. I decided to write this article after answering a similar question on StackOverflow.

Read More

Java and Database Newsletter, Issue 1

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

Introduction

I started my newsletter in November 2015, and every time I was publishing a new article, I would send it to my newsletter subscribers as well.

This year, I decided to change the format of my newsletter. Instead of creating a new issue for every article, the newsletter will now contain links to the best articles I read over the past two weeks.

Read More

Multidimensional array mapping with JPA and Hibernate

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

Introduction

In this article, I’m going to present the best way to map a Java multidimensional array when using JPA and Hibernate.

While one-dimensional array types have long been supported by the Hibernate Types open-source project, starting with the 2.9 release, you can now persist multidimensional array entity attributes with JPA and Hibernate.

Read More

The best way to use a Hibernate ResultTransformer

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

Introduction

In this article, I’m going to present the best way to use a Hibernate ResultTransformer so that you can customize the result set of a given JPA or Hibernate query.

As I already explained, the Hibernate ResultTransformer is a very powerful mechanism, allowing you to customize a JPQL, Criteria API, or native SQL query result set in any possible way.

Read More

The best way to prevent JPA and Hibernate performance issues

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

Introduction

In this article, I’m going to present the best way to prevent performance issues when using JPA and Hibernate.

Many years ago, I used to work as a team leader, and, one day, the General Manager asked me to take a look at a project that was in big trouble.

The application in question had been developed by a team of software developers for over 9 months, and the client had just tested in a production-like environment.

The client got very upset when realizing that the application was barely crawling. For instance, I was told that a query had been running for 10 hours without showing any signs of stopping.

After analyzing the project, I identified many areas that could have been improved, and that’s how my passion for high-performance data access was born.

Read More

How to migrate the hilo Hibernate identifier optimizer to the pooled strategy

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

Introduction

In this article, I’m going to show you how to migrate from the legacy hilo sequence-based identifier optimizer to the pooled Hibernate strategy.

I decided to write this article after having a discussion with Gerd Aschemann on Twitter about addressing the HHH-13783 Hibernate issue.

Read More