How to use Postgres JSONB datatype with JPA?

后端 未结 3 906
一生所求
一生所求 2020-12-01 05:38

Im not finding a way to map the JSON and JSONB datatypes from PostgreSQL using JPA (EclipseLink). Is some one using this datatypes with JPA and can give me some working exam

3条回答
  •  鱼传尺愫
    2020-12-01 05:56

    I think I found an analogy to Hibernate's UserType for EclipseLink.

    http://www.eclipse.org/eclipselink/documentation/2.6/jpa/extensions/annotations_ref.htm#CHDEHJEB

    You have to make a class that implements org.eclipse.persistence.mappings.converters.Converter and does the conversion for you, then use the @Convert annotation on every field where you are using that type.

提交回复
热议问题