vladmihalcea / hypersistence-utils

The Hypersistence Utils library (previously known as Hibernate Types) gives you Spring and Hibernate utilities that can help you get the most out of your data access layer.
Apache License 2.0
2.41k stars 368 forks source link

JsonBlobType not working with Oracle in case of @Audited #337

Closed kuldeeparora89 closed 3 years ago

kuldeeparora89 commented 3 years ago

Hi,

I am getting below error -

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)]

This error only happens when I apply @Audited on the entity.

Code -

@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;

Please suggest !!

vladmihalcea commented 3 years ago

There are two ways you can fix this problem:

  1. You investigate it, provide a fix, and send a Pull Request which I'll review when I have some time.
  2. Your company employs my consulting services to investigate the issue and provide a fix.

You can choose whichever option works best for you.

kuldeeparora89 commented 3 years ago

Strangely by just changing the name of type to "jsonb-lob" it worked -

@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;
vladmihalcea commented 3 years ago

I'm glad you found the solution.