【问题标题】:Hibernate : JsonBlobType not working with Oracle in case of @AuditedHibernate:在@Audited 的情况下,JsonBlobType 不能与 Oracle 一起使用
【发布时间】:2021-10-07 20:56:43
【问题描述】:

正如论坛中的建议 - https://vladmihalcea.com/oracle-json-jpa-hibernate/

我正在使用以下代码在实体中使用字符串类型映射 oracle blob JSON 列 -

@TypeDefs({ @TypeDef(name = "jsonb", typeClass = JsonBlobType.class) })
    @Audited
    @Table(name = "hyperform_common_config")
    @Entity
    public class CommonConfig implements Serializable{

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "id")
    private long id;
    @Type(type = "jsonb")
    @Column(name = "config_data")
    private String configData;

但是 JsonBlobType 在 @Audited 的情况下不起作用。错误 -

Caused by: org.hibernate.MappingException: Could not determine type for: jsonb-lob, at table: hyperform_common_config_AUD, for columns: [org.hibernate.mapping.Column(config_data)]

我需要为审计表做任何额外的配置吗?

【问题讨论】:

    标签: hibernate jpa hibernate-mapping


    【解决方案1】:

    奇怪的是,只需将类型名称更改为“jsonb-lob”就可以了 -

    @TypeDefs({ @TypeDef(name = "jsonb-lob", typeClass = JsonBlobType.class) })
    @Audited
    @Table(name = "hyperform_common_config")
    @Entity
    public class CommonConfig implements Serializable{
    
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Id
        @Column(name = "id")
        private long id;
        @Type(type = "jsonb-lob")
        @Column(name = "config_data")
        private String configData;
    

    【讨论】:

      猜你喜欢
      • 2016-01-23
      • 2018-02-08
      • 2017-05-27
      • 2017-11-27
      • 1970-01-01
      • 1970-01-01
      • 2019-05-23
      • 2011-05-12
      • 2020-06-01
      相关资源
      最近更新 更多