Hibernate Envers audit Table Column Changes from jsonb to uuid

Description

I have a jsonb column in an Entity annotated as shown in the sample code. Everything works fine without the @Audited annotation. Adding the Audited annotation creates the org_master_aud table with the column custom_fields of type uuid instead of jsonb and the insert fails

```
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
@Audited
public class OrgMaster {
@Type(type = "jsonb")
@Column(columnDefinition = "jsonb",name="custom_fields",nullable=false)
private JsonNode customFields;
}
```
org.springframework.orm.jpa.JpaSystemException: Unable to perform beforeTransactionCompletion callback: org.hibernate.exception.DataException: could not execute statement; nested exception is org.hibernate.HibernateException: Unable to perform beforeTransactionCompletion callback: org.hibernate.exception.DataException: could not execute statement
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:353)
.
.
.
.
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1352)
... 94 more
Caused by: org.postgresql.util.PSQLException: ERROR: invalid input syntax for type uuid: "{}"
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2578)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2313)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:331)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:159)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:125)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
... 105 more

Attached

the Snapshots of the custom_fields column in main and audit table where the audit table column is uuid whereas the main table is jsonb. Both are autogenerated.

Environment

None

Activity

Show:
ganaraj tejasvi
May 5, 2020, 6:54 PM

Did a Bit More testing the same is not Observed in Hibernate Version 5.4.11.Final

This issue is observed only in version 5.4.12.Final.

Again when I changed it over to 5.4.14 it is working fine.

 

ganaraj tejasvi
May 5, 2020, 6:55 PM

Spring Boot is Currently on 5.4.12.Final, hence the issue was observed

Assignee

Chris Cranford

Reporter

ganaraj tejasvi

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure