Hypersistence Utils

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 access layer.
Alternatives To Hypersistence Utils
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
5 days ago10apache-2.0Java
Apache Wicket - Component-based Java web framework
Yfax Parent274
2 years ago9Java
SprintBoot开发的Rest API接口项目实战,集成了拦截器,日志处理,mysql,mybatis, oauth2.0, spring secutity等,已投入生产线上使用。应用了https://github.com/hemin1003/spring-boot-study 所含功能。配套的后台管理系统实战见:https://github.com/hemin1003/aylson-parent
Weixin Mp Java227
9 years ago9apache-2.0Java
Micronaut Spring154113 days ago16June 27, 202213apache-2.0Java
A collection of utilities for Spring users of Micronaut
2 years ago1apache-2.0
4 years ago10May 24, 2019apache-2.0Java
基于对spring boot的二次封装,目的是减少重复代码,提高开发效率
8 months ago2agpl-3.0Java
Spring Hibernate Query Utils56
2 years ago5January 06, 20218mitJava
Library giving tools to detect N+1 queries and count the queries generated with Spring and Hibernate
10 months ago29Java
Java 大合集 , 包含多种框架的运用 , 微服务 , 压测 , 性能分析 , 文档 , 源码分析
Aop Logging46
9 years ago1May 22, 20142otherJava
Declarative annotation based logging in Java Spring applications.
Alternatives To Hypersistence Utils
Select To Compare

Alternative Project Comparisons

License Maven Central JavaDoc

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!


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 6.2 to 6.1, 6.0, 5.6, 5.5, 5.4, 5.3, 5.2, 5.1, and Hibernate 5.

Installation Guide

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

Hibernate 6.2


Hibernate 6.1 and 6.0


Hibernate 5.6 and 5.5


Hibernate 5.4, 5.3 and 5.2


Hibernate 5.1 and 5.0


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 because not all projects may need them.

More, 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 6.2, 6.1 and 6.0
Hibernate 5.6, 5.5, 5.4, 5.3, and 5.2

Hibernate 5.1, 5.0
Guava Optional Maven Dependency

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

Java Money and Currency API Optional Maven Dependency

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

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:




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 6

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

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:

    name = "json", typeClass = JsonType.class
package io.hypersistence.optimizer;

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

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

@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

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.


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.


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


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

Generic Types



The BaseJpaRepository is a much better alternative to the default Spring Data JpaRepository because it does not provide a findAll method or a save method that makes no sense in JPA terminology.

To use the BaseJpaRepository utility, make sure that you provide the repositoryBaseClass attribute in the @EnableJpaRepositories configuration to reference the BaseJpaRepositoryImpl from the Hypersistence Utils project:

    value = "your.repository.package",
    repositoryBaseClass = BaseJpaRepositoryImpl.class
public class JpaConfiguration {

The your.repository.package is the Java package of your Spring repositories.


While the BaseJpaRepository is to be preferred, in case you need to use the default JpaRepository, then you can at least extend the HibernateRepository as well to deprecate the methods that may cause problems.

To use the HibernateRepository, make sure that you include the io.hypersistence.utils.spring.repository package in your @EnableJpaRepositories configuration:

    value = {
public class JpaConfiguration {

The your.repository.package is the Java package of your Spring repositories.

Identifier Generators
Naming Strategy
DTO Projection and ResultTransformer
SQL Statement Count Validator


  • Java version supported by the Hibernate ORM version you are using.
  • SLF4J
  • Jackson Databind

Issue management

If you have an issue, then there are two ways to address it.

Option 1: Providing your own fix

Since this project is open-source, you have the ability to fix any issue you bump into. Therefore, when dealing with a problem, this is what you need to do:

  1. Provide a replicating test case using the existing test cases as a template
  2. Provide a fix proposal
  3. Send a Pull Request with the fix proposal and the test case

Option 2: Paid support

If you don't have the time to provide a fix, then I can fix your issue via consulting. If you're in a hurry, this is going to be your best option.

Are you struggling with application performance issues?

Hypersistence Optimizer

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. No more performance issues, no more having to spend countless hours trying to figure out why your application is barely crawling.

Imagine discovering early during the development cycle that you are using suboptimal mappings and entity relationships or that you are missing performance-related settings.

More, with Hypersistence Optimizer, you can detect all such issues during testing and make sure you don't deploy to production a change that will affect data access layer performance.

Hypersistence Optimizer is the tool you've been long waiting for!


If you are interested in on-site training, I can offer you my High-Performance Java Persistence training, which can be adapted to one, two or three days of sessions. For more details, check out my website.


If you want me to review your application and provide insight into how you can optimize it to run faster, then check out my consulting page.

High-Performance Java Persistence Video Courses

If you want the fastest way to learn how to speed up a Java database application, then you should definitely enroll in my High-Performance Java Persistence video courses.

High-Performance Java Persistence Book

Or, if you prefer reading books, you are going to love my High-Performance Java Persistence book as well.

High-Performance Java Persistence book High-Performance Java Persistence video course

Contributing Guide

The project uses Maven Toolchains as different modules are compiled and tested using different Java versions.

Hypersistence Utils 6 requires Java 11 while the other modules are compiled with Java 8.

To see how to configure Maven Toolchains, check out this article.

The project uses various database systems for integration testing, and you can configure the JDBC connection settings using the DatasourceProvider instances (e.g., PostgreSQLDataSourceProvider), and the project uses Testcontainers to bootstrap a Docker container with the required Oracle, SQL Server, PostgreSQL, or MySQL instance on demand.

If you are a regular contributor, it's advisable to set up the required database locally or use the Docker Compose configuration provided in the docker folder, as bootstrapping the containers on demand is slower, and your tests are going to take longer to run.

If you want to fix an issue or add support for a new feature, please provide the associated integration test case that proves the improvement is working as expected.

Popular Utilities Projects
Popular Spring Projects
Popular Libraries Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Spring Boot
Spring Data Jpa
Performance Testing