我使用Hibernate Envers:
@Entity
@Table(name = "user")
@Audited
class User()
{
private String id;
@Formula("(SELECT name FROM other c where c.id = id)")
private Integer name;
}
Run Code Online (Sandbox Code Playgroud)
它抛出:
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]:调用init方法失败; 嵌套异常是org.hibernate.envers.configuration.internal.metadata.FormulaNotSupportedException:目前不支持公式映射(除了@DiscriminatorValue)
如何使用@Formula和Hibernate Envers计算实体属性?
仅供参考当我删除Hibernate Envers时,它可以正常工作.