想知道这个主题是否有新的发展?
我所面临的可能是大多数处于类似情况的人在尝试将hibernate-types-52-library类型与envers一起使用时所面临的问题…,此错误:
Invocation of init method failed; nested exception is org.hibernate.MappingException: Type not supported for auditing: com.vladmihalcea.hibernate.type.range.PostgreSQLRangeType, on entity ...
我尝试创建一种自定义方言,如:
public class CustomPostgresDialect extends PostgreSQL10Dialect {
public CustomPostgresDialect() {
super();
this.registerHibernateType(Types.OTHER, PostgreSQLRangeType.class.getName());
this.registerColumnType(1111, "range");
}
}
我在application.yml(source和tests)中都有这一点:
jpa:
database-platform: <path>.CustomPostgresDialect
show-sql: false
open-in-view: false
properties:
hibernate:
dialect: <path>.CustomPostgresDialect
@Entity
@TypeDef(name="range", typeClass = PostgreSQLRangeType.class, defaultForType = Range.class)
public class Spec extends TemporalTable implements Serializable {
@Type(type = "range")
private Range<Integer> range;
}
@Entity
@TypeDef(name="range", typeClass = PostgreSQLRangeType.class, defaultForType = Range.class)
public class Spec extends TemporalTable implements Serializable {
@Type(type = "range")
private Range<Integer> range;
}
如果这不起作用,是否可以将[0,15]保存为varchar,然后将其转换为range?这样hbn envers就不会抱怨了。
暂无答案!
目前还没有任何答案,快来回答吧!