Class SimpleJsonbConverter
- java.lang.Object
-
- de.terrestris.shoguncore.hibernate.SimpleJsonbConverter
-
- All Implemented Interfaces:
javax.persistence.AttributeConverter<java.util.Map<java.lang.String,java.lang.String>,java.lang.String>
public class SimpleJsonbConverter extends java.lang.Object implements javax.persistence.AttributeConverter<java.util.Map<java.lang.String,java.lang.String>,java.lang.String>A JPA converter that can be used to convert jsonb fields into a map. Currently only works with 'simple' json content (only one level objects like {"name": "peter", "someprop": 345}).Please note that you'll need to switch to pgjdbc-ng from https://github.com/impossibl/pgjdbc-ng instead of using the standard postgres driver.
Please also note that if you want optimal performance you'll need to add an index manually, hibernate can only create btree indexes.
-
-
Constructor Summary
Constructors Constructor Description SimpleJsonbConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringconvertToDatabaseColumn(java.util.Map<java.lang.String,java.lang.String> attribute)java.util.Map<java.lang.String,java.lang.String>convertToEntityAttribute(java.lang.String dbData)
-
-
-
Method Detail
-
convertToDatabaseColumn
public java.lang.String convertToDatabaseColumn(java.util.Map<java.lang.String,java.lang.String> attribute)
- Specified by:
convertToDatabaseColumnin interfacejavax.persistence.AttributeConverter<java.util.Map<java.lang.String,java.lang.String>,java.lang.String>
-
convertToEntityAttribute
public java.util.Map<java.lang.String,java.lang.String> convertToEntityAttribute(java.lang.String dbData)
- Specified by:
convertToEntityAttributein interfacejavax.persistence.AttributeConverter<java.util.Map<java.lang.String,java.lang.String>,java.lang.String>
-
-