【发布时间】:2020-03-30 10:00:54
【问题描述】:
我遇到了这样的错误。
嵌套异常是 java.lang.IllegalArgumentException: 给定的字符串值: [{"id": "DFW", "namd": "Dallas, TX (DFW-Dallas-Fort Worth Intl.)", "name_kr" : "댈러스, 텍사스 (DFW-댈러스-포트워스 국제공항)"}, {"id": "DAL", "namd": "达拉斯, TX (DAL-Love Field)", "name_kr": "댈라스 , 텍사스 (DAL-러브필드 공항)"}, {"id": "RBD", "namd": "达拉斯, TX (RBD-Executive)", "name_kr": "댈러스, 텍사스 (RBD-이그제큐티브)" }, {"id": "ADS", "namd": "Dallas, TX (ADS-Addison)", "name_kr": "댈러스, 텍사스 (ADS-애디슨 공항)"}] 无法转换为 Json 对象
这个值是我的 postgres 行的 jsonb 列。
这是我的表格实体示例(相关问题)。
@Data
@Entity
@Table(name = "expedia_region_union")
@JsonInclude(JsonInclude.Include.NON_NULL)
@TypeDefs({
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
})
public class ExpediaRegionUnion {
@Id
// @GeneratedValue
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column( columnDefinition = "uuid", updatable = false )
private String regionId;
@Type(type = "jsonb")
@Column(columnDefinition = "airport")
private HashMap airport;
@Column(name = "source_time")
private String sourceTime;
在我看来,实体图似乎无法处理机场字段。
airport 字段被列为 jsonb 类型。
但我制定了像HashMap 这样的实体规则。
样本数据
about airport field
[
{
"id": "DFW",
"namd": "Dallas, TX (DFW-Dallas-Fort Worth Intl.)",
"name_kr": "댈러스, 텍사스 (DFW-댈러스-포트워스 국제공항)"
},
{
"id": "DAL",
"namd": "Dallas, TX (DAL-Love Field)",
"name_kr": "댈라스, 텍사스 (DAL-러브필드 공항)"
},
{
"id": "RBD",
"namd": "Dallas, TX (RBD-Executive)",
"name_kr": "댈러스, 텍사스 (RBD-이그제큐티브)"
},
{
"id": "ADS",
"namd": "Dallas, TX (ADS-Addison)",
"name_kr": "댈러스, 텍사스 (ADS-애디슨 공항)"
}
]
如何更改实体设置?
【问题讨论】:
标签: java postgresql hibernate jpa