PostgreSQL audit logging using triggers
Introduction In this article, we are going to see how we can implement an audit logging mechanism using PostgreSQL database triggers to store the CDC (Change Data Capture) records. Thanks to JSON column types, we can store the row state in a single column, therefore not needing to add a new column in the audit log table every time a new column is being added to the source database table.
MySQL audit logging using triggers
Introduction In this article, we are going to see how we can implement an audit logging mechanism using MySQL database triggers to store the old and new row states in JSON column types.
Java Map to JSON mapping with JPA and Hibernate
Introduction In this article, we are going to see how we can store Java Map entity attributes in JSON columns when using JPA, Hibernate, and the Hypersistence Utils project. While you can also persist Java Map entity attributes in PostgreSQL HStore columns, a JSON column type is a much more common option, especially since it works with other relational databases, like Oracle, SQL Server, or MySQL. As you already have seen, the Hypersistence Utils project allows you to map a JSON column type to a wide variety of JPA entity attributes, like… Read More
JPA and Hibernate Query setParameter – User Guide
Introduction In this article, I’m going to show you how the JPA Query setParameter method works for basic entity attributes, and how you can use it when dealing with custom Hibernate types. If you ever stumbled on the “column is of type jsonb but expression is of type bytea” PostgreSQL issue and didn’t know how to fix it, then you should definitely read this article.
Multiline String literals with Java Text Blocks
Introduction In this article, show you how the new Java Text Blocks can help you increase the readability of JPQL, SQL queries, or JSON string values. Back in 2005, I was developing a .NET project and really liked the C# Verbatim String Literal feature since it allows you to write a multiline string value without having to concatenate each individual line. The Java 13 Text Blocks feature now offers the possibility of creating a multiline Java String values.
How to map SQL Server JSON columns using JPA and Hibernate
Introduction In this article, we are going to see how easy it is to map an SQL Server JSON column when using the Hypersistence Utils project. The Hypersistence Utils project supports JSON column types for PostgreSQL and MySQL and Oracle, and, as you will see in this article, the JsonType works just fine with Microsoft SQL Server.
How to map Oracle JSON columns using JPA and Hibernate
Introduction In this article, we are going to see how to map the Oracle JSON column storage types when using JPA and Hibernate. The Hypersistence Utils project provides a generic JsonType that works with Oracle, SQL Server, PostgreSQL, and MySQL, and it can even use the columnDefinition attribute of the JPA @Column annotation to determine the underlying database column type.
How to map a JSON collection using JPA and Hibernate
Introduction The open-source Hypersistence Utils project allows you to map Java objects or Jackson JsonNode as JPA or Hibernate entity properties, and, thanks to our awesome contributors, we have added support for storing type-safe JSON collections. In this article, you are going to see how to achieve this goal.
The hibernate-types open-source project is born
Introduction Recently, I got a very interesting request from one of my readers. Since I’ve been providing many custom types to support JSON, ARRAY, or nullable Character types, I decided to start a new open-source project to make it easier for you to get these extra Hibernate Types.
How to store schema-less EAV (Entity-Attribute-Value) data using JSON and Hibernate
Introduction One of my Twitter followers has recently asked me about a way of storing EAV (Entity-Attribute-Value) data using JPA and Hibernate, and, because this is a very good question, I decided to turn into a blog post. In this article, you are going to see how you can use JSON types to store schema-less EAV data.

