Class JsonToMapConverter

java.lang.Object
cn.net.pap.example.proguard.convert.JsonToMapConverter
All Implemented Interfaces:
jakarta.persistence.AttributeConverter<Map<String,Object>,String>

public class JsonToMapConverter extends Object implements jakarta.persistence.AttributeConverter<Map<String,Object>,String>
使用方式如下,则会把字段存储一个字符串的类型
  • Constructor Details

    • JsonToMapConverter

      public JsonToMapConverter()
  • Method Details

    • convertToDatabaseColumn

      public String convertToDatabaseColumn(Map<String,Object> attribute)
      Specified by:
      convertToDatabaseColumn in interface jakarta.persistence.AttributeConverter<Map<String,Object>,String>
    • convertToEntityAttribute

      public Map<String,Object> convertToEntityAttribute(String dbData)
      Specified by:
      convertToEntityAttribute in interface jakarta.persistence.AttributeConverter<Map<String,Object>,String>