【发布时间】:2021-03-23 03:25:24
【问题描述】:
我在 postgreSql 中有一个与表 pc_customer 的实体映射。 在使用 R2DBC 将字段 jsonb 从 postgreSql 映射到 Java 中的 Object 时出现问题。这是我的代码:
@EqualsAndHashCode(callSuper = false)
@Data
@Builder
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Table("pc_customer")
public class Customer extends KunlunDomain {
@Id
private Long id;
private String secret;
private String code;
@Column(value = "customer_authorities")
CustomerAuthorities customerAuthorities;
String zaloId;
@Data
@Builder
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public static class CustomerAuthorities implements Serializable {
boolean importParcel = false;
boolean printParcelStamp = false;
boolean draftServicesEnable = true;
}
}
这是我收到的错误 **引起:org.springframework.core.convert.ConverterNotFoundException:找不到能够从类型 [io.r2dbc.postgresql.codec.Json$JsonByteArrayInput] 转换为类型 [*com.example.Customer$CustomerAuthorities ]
列 customer_authorities 是 jsonb。 那么在这种情况下我能做些什么来将 jsonb 映射到一个类呢? 对不起我的英语
【问题讨论】: