Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

hypersistence-utils

> 后端框架
Open source

The Hypersistence Utils library (previously known as Hibernate Types) gives you Spring and Hibernate utilities that can help you get the most out of your data a

2.7K stars0 likes2 views
WebsiteGitHub

About

The Hypersistence Utils library (previously known as Hibernate Types) gives you Spring and Hibernate utilities that can help you get the most out of your data a

Migrating to version 3

The project name was changed from Hibernate Types to Hypersistence Utils because the scope of the project is much broader now, offering Spring utilities as well.

For this reason, when migrating from the Hibernate Types 2.x to Hypersistence Utils 3.x, you will need to follow these steps:

  1. First, you will need to change your Maven or Gradle dependency, as illustrated by the Installation Guide.
  2. Second, you will need to change the package name from com.vladmihalcea.hibernate to io.hypersistence.utils.hibernate.
  3. Third, you will need to change the package name from com.vladmihalcea.spring to io.hypersistence.utils.spring.

That's it!

Introduction

The Hypersistence Utils project gives you general-purpose utilities for both Spring and Hibernate.

The main advantage of this project is that it supports a broad range of Hibernate versions, spanning from Hibernate ORM 7.4, 7.3, 7.2, 7.1, 7.0, to 6.6, 6.5, 6.4, 6.3, 6.2, 6.1, 6.0, 5.6, 5.5, 5.4, 5.3, 5.2, 5.1, and 5.0.

Installation Guide

Depending on the Hibernate version you are using, you need to add the following dependency:

Hibernate 7.4 and 7.3

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-73</artifactId>
    <version>3.15.4</version>
</dependency>

Hibernate 7.2 and 7.1

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-71</artifactId>
    <version>3.15.4</version>
</dependency>

Hibernate 7.0 (Commercial support only)

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-70</artifactId>
    <version>3.15.4</version>
</dependency>

Hibernate 6.6, 6.5, 6.4, and 6.3

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-63</artifactId>
    <version>3.15.4</version>
</dependency>

Hibernate 6.2 (Commercial support only)

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-62</artifactId>
    <version>3.9.4</version>
</dependency>

Hibernate 6.1 and 6.0 (Commercial support only)

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-60</artifactId>
    <version>3.9.4</version>
</dependency>

Hibernate 5.6 and 5.5 (Commercial support only)

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-55</artifactId>
    <version>3.9.5</version>
</dependency>

Hibernate 5.4, 5.3 and 5.2 (Commercial support only)

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-52</artifactId>
    <version>3.7.6</version>
</dependency>

Hibernate 5.1 and 5.0 (Commercial support only)

<dependency>
    <groupId>io.hypersistence</groupId>
    <artifactId>hypersistence-utils-hibernate-5</artifactId>
    <version>3.7.0</version>
</dependency>

Optional Maven Dependencies

The Hypersistence Utils project defines a list of optional dependencies that you will have to declare explicitly in your project in order to use them.

The reason why all these dependencies are optional, like Guava, Jackson, or PostgreSQL JDBC Driver, is that not all projects may need them.

Moreover, the dependency version is extremely important because, from time to time, security issues may be discovered that get fixed in newer versions.

So, relying on this library to supply you with the dependency versions is a very dangerous thing to do.

For instance, there have been 65 security issues discovered in the Jackson Data Bind library this project is heavily relying on.

To avoid risking security issues, you need to take the responsibility of constantly upgrading all the dependencies that you are using along with the Hypersistence Utils library.

JSON Optional Maven Dependencies

If you are using JSON Types, then you might be interested in setting the following dependencies based on your Hibernate version:

Hibernate 7 and 6
xml
<dependency>
    <groupId>com.fasterxml.jackson.module</groupId>
    <artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
    <version>${jackson-module-jakarta-xmlbind-annotation}</version>
</dependency>
Hibernate 5
xml
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>${jackson-databind.version}</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.module</groupId>
    <artifactId>jackson-module-jaxb-annotations</artifactId>
    <version>${jackson-module-jaxb-annotation}</version>
</dependency>
Guava Optional Maven Dependency

If you are mapping a Range using Guava, then you have to provide the Guava dependency explicitly:

xml
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>${guava.version}</version>
</dependency>
Java Money and Currency API Optional Maven Dependency

If you are mapping a MonetaryAmount, then you have to provide the Moneta dependency explicitly:

xml
<dependency>
    <groupId>org.javamoney</groupId>
    <artifactId>moneta</artifactId>
    <version>${moneta.version}</version>
    <type>pom</type>
</dependency>
PostgreSQL Optional Maven Dependency

If you are mapping a PostgreSQL-specific column type (e.g., inet, hstore, array, interval), then you have to provide the PostgreSQL dependency explicitly:

xml
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>${postgresql.version}</version>
</dependency>

Features

JSON

Generic JSON Type

The JsonType allows you to map JSON column types, no matter if you're using Oracle, SQL Server, PostgreSQL or MySQL.

Hibernate 7 and 6

If you're using Hibernate 7 or 6, you can map any JSON column to Map, List, POJO, String, or JsonNode entity property:

java
@Type(JsonType.class)
private Map<String, String> properties = new HashMap<>();
Hibernate 5

If you're using Hibernate 5, you can either provide the fully-qualified name of the Hibernate Type:

@Type(type = "io.hypersistence.utils.hibernate.type.json.JsonType")

Or, you can add the following mapping to your package-info.java class in the same package where your JPA entities are located:

java
@TypeDef(
    name = "json", typeClass = JsonType.class
)
package io.hypersistence.optimizer;

import io.hypersistence.utils.hibernate.type.json.JsonType;
import org.hibernate.annotations.TypeDef;

Later, you can map the Map, List, POJO, String, or JsonNode entity properties to JSON columns like this:

java
@Type(type = "json")
private Map<String, String> properties = new HashMap<>();

For more details, check out this article.

Best Practices

When mapping a JSON column type to a POJO, List<POJO> or Map<String, POJO>, you need to make sure that the POJO type overrides the default equals and hashCode methods and implements them according to the JSON object content.

Otherwise, the Hibernate dirty checking mechanism may trigger unexpected UPDATE statements. Check out the #134 issue for more details.

Database-specific JSON types
Oracle

When using Oracle, you have several options:

  • you can use the generic JsonType that can work with the JSON, VARCHAR, or BLOB column types, as long as you hint the column type using the columnDefinition attribute of the JPA @Column annotation.
  • you can use the JsonStringType to map a VARCHAR2 column type storing JSON.
  • you can use the JsonBlobType to map a BLOB column type storing JSON.

For more details, check out this article.

SQL Server

When using SQL Server, you can use the generic JsonType or the JsonStringType to map an NVARCHAR column type storing JSON.

For more details, check out this article.

PostgreSQL

When using PostgreSQL, you can use the generic JsonType or the JsonBinaryType to map both jsonb and json column types.

For more details, check out this article.

MySQL

When using MySQL, you can use the generic JsonType or the JsonStringType to map the json column type.

For more details, check out this article.

JSON mapping examples
  • How to map a POJO to a JSON column using JPA and Hibernate
  • How to map a String JPA property to a JSON column using Hibernate
  • How to map a Jackson JsonNode to a JSON column
  • How to map JSON collections using JPA and Hibernate
  • How to map a Java Map entity property as a JSON column with JPA and Hibernate
  • How to map Java Records to JSON columns using Hibernate
  • How to map polymorphic JSON objects with JPA and Hibernate
  • How to encrypt and decrypt JSON properties with JPA and Hibernate
  • Why you should use Hibernate Dynamic Update for JSON properties
  • How to map Oracle JSON columns using JPA and Hibernate
  • How to map SQL Server JSON columns using JPA and Hibernate
  • How to customize the Jackson ObjectMapper used by Hypersistence Utils
  • How to customize the JSON Serializer used by Hypersistence Utils
  • How to fix the Hibernate No Dialect mapping for JDBC type: 1111 issue when mixing JSON types with native SQL queries
  • How to fix the column is of type jsonb but expression is of type record or bytea issue

ARRAY

  • How to map a PostgreSQL ARRAY to a Java List with JPA and Hibernate
  • How to map the PostgreSQL ARRAY to Java Arrays with JPA and Hibernate
  • Multidimensional array mapping with JPA and Hibernate
  • How to map the HSQLDB ARRAY type with JPA and Hibernate

PostgreSQL Types (e.g. ENUM, INET, HSTORE, RANGE)

  • [Java Enum to PostgreSQL Enum Type](https://vladmihalcea.co

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaarraycustom-typesenumhibernate

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架