Hibernate HSQLDB ARRAY Type

Introduction

As previously explained, although Hibernate does not support database ARRAY column types by default, you can easily implement a custom Hibernate ArrayType. While the previous solution worked on PostgreSQL, in this article, you are going to see that it is fairly easy to adapt it to HSQLDB.

Domain Model

Assuming we have the following Event entity in our system:

We need a way to persist the String[] and Integer[] entity attributes since Hibernate, by default, does not support database-specific ARRAY types.