Skip to content

This is an example how to save a JSON object to a MySQL database using Hibernate. Integration tests are included.

Notifications You must be signed in to change notification settings

mbajer42/hibernate-mysql-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Save JSON to MySQL using Hibernate

This is an example how to save JSON to a MySQL database (version > 5.7) using Hibernate.

For this, a custom Hibernate UserType needs to be implemented. In order to serialize a Java object to JSON (or to deserialize JSON to a Java object) Jackson library is used. In order to be able to save more than only one type of JSON, the custom UserType also implements Hibernate's ParameterizedType. This allows to specify the type using Hibernate's Parameter annotation.

Integrations are performed using Maven Failsafe Plugin. Docker maven plugin allows to build Docker images and, hence, perform the integration test on a real database.

About

This is an example how to save a JSON object to a MySQL database using Hibernate. Integration tests are included.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages