hibernatespring-data-jpahibernate-envershibernate-types

Hibernate envers does not recognize PostgreSQLInetType type from hibernate-types-52


Hibernate envers not able to recognize custom types created using @TypeDef annotations from hibernate-types library.

I have an entity, that uses custom type PostgreSQLInetType.class:

@Entity
@Table(name = "my_acl")
@TypeDef(typeClass = PostgreSQLInetType.class, defaultForType = Inet.class)
@Audited
public class MyAcl {

  Inet acl;

//other fields, getters\setters etc.



}

But during my SpringBoot application start, I'm getting the following exception:

Caused by: org.hibernate.MappingException: Type not supported for auditing: com.vladmihalcea.hibernate.type.basic.PostgreSQLInetType, on entity org.acme.MyAcl, property 'acl'.

Is there any way to fix this or tell Envers how to map PostgreSQLInetType?


Solution

  • To be usable by Envers, the type would have to implement the org.hibernate.type.BasicType interface.