akoufa / quarkus-hibernate-types

Quarkus hibernate types extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

quarkus-hibernate-types

License GitHub Workflow Status (branch) GitHub tag (latest SemVer) Maven Central

This Quarkus Hibernate types extension is based on the https://github.com/vladmihalcea/hibernate-types.

Changes:

  • remove unused methods
  • inject ObjectMapper from Arc container
  • defined String constants for JSON types.
  • remove hibernate clone method and reflection for the native image.

How to

Quarkus Hibernate types

  • JSON

Add this maven dependency to you project.

<dependency>
    <groupId>org.lorislab.quarkus</groupId>
    <artifactId>quarkus-hibernate-types</artifactId>
    <version>0.1.1</version>
</dependency>

Add the @TypeDef annotation to your entity class and to entity field @Type annotation.

import org.lorislab.quarkus.hibernate.types.json.JsonBinaryType;
import org.lorislab.quarkus.hibernate.types.json.JsonTypes;
import javax.persistence.*;

@TypeDef(name = JsonTypes.JSON_BIN, typeClass = JsonBinaryType.class)
@Entity
public class Data {

    @Type(type = JsonTypes.JSON_BIN)
    @Column(columnDefinition = JsonTypes.JSON_BIN)
    private Parameters data = new Parameters();

}

Current implemented JSON types

Name Value typeClass
JsonTypes.JSON_STRING json JsonStringType.class
JsonTypes.JSON_BIN jsonb JsonBinaryType.class
JsonTypes.JSON_BLOB jsonb-lob JsonBlobType.class
JsonTypes.JSON_NODE_STRING jsonb-node JsonNodeStringType.class
JsonTypes.JSON_NODE_BIN jsonb-node JsonNodeBinaryType.class

Create a release

mvn semver-release:release-create

Create a patch branch

mvn semver-release:patch-create -DpatchVersion=x.x.0

About

Quarkus hibernate types extension

License:Apache License 2.0


Languages

Language:Java 100.0%