【发布时间】:2022-08-22 06:14:01
【问题描述】:
我正在尝试从 oracle 迁移到 postgresql。 在 oracle 中,我们将 @Lob 数据添加到用于保存大量数据的字段中。
@Lob
private String A_Value;
对于 postgresql,我们需要使用 json/jsonb 代替 lob 数据。我为此做了以下更改。
@TypeDefs({
@TypeDef(name=\"json\", typeClass=JsonStringType.class),
@TypeDef(name=\"jsonb\", typeClass=JsonBinaryType.class)
})
public class AbcM implements Serializable{
---------
@Type(type=\"jsonb\")
@Column(name=\"A_Value\", columnDefinition=\"jsonb\")
private String A_Value;
}
@Repository
public interface ARepository extends JPARepository<AuditM,Long>{}
##Impl class to save data
@Override
@Async
public CompletableFuture<String> saveRequest(AbcM model){
ARepository.saveAndFlush(model);
}
##ERROR:列 A_Value 的类型为 jsonb,但表达式的类型为 bigint 重写或转换表达式
您能否建议我应该如何保存数据而不会出现任何错误。
标签: spring spring-boot hibernate