Envers seems to ignore jdb type setting `@JdbcTypeCode` for UUID type

Suppose there is an entity like:

@Audited
@Entity
class Order {
    ...
    @Embedded
    var coupon: Coupon? = null
    ...
}

and the embedded class:

@Embeddable
class Coupon {
    ...
    @JdbcTypeCode(java.sql.Types.VARCHAR)
    var couponId: UUID? = null
    ...
}

The hibernate shows create table query for Order like:

Hibernate: 
    create table order (
        ...
        coupon_id varchar(36),
        ...
)

but the envers shows query like:

Hibernate: 
    create table order_aud (
        ...
        coupon_id uuid,
        ...
)

So it seems like @JdbcTypeCode(java.sql.Types.VARCHAR) isn’t working for the envers table.
@Column(columnDefinition = "varchar") doesn’t work as well.
Tested on:

  • Spring Boot 3.2
  • Hibernate 6.3.1

Any idea to solve this problem please?

That’s a bug. Search the Hibernate Jira issue tracker to see if you can find an existing Jira issue for this problem and if you can’t find one, please create a new one. Also, please attach a reproducer for this problem based on our test case template: hibernate-test-case-templates/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub

1 Like