Formula Mappings Not Currently Supported - Hibernate ORM Envers

I am using 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;
}

he throws:

[org / springframework / downloads / Auto Config / ORM / JPA / HibernateJpaAutoConfiguration.class]: The init method call failed; nested exception org.hibernate.envers.configuration.internal.metadata.FormulaNotSupportedException: Formula mappings (except @DiscriminatorValue) are not currently supported

How to calculate entity attributes using @Formula and Hibernate Envers?

FYI When I remove Hibernate Envers, it works correctly.

+4
source share
1 answer

, Envers @Formula , . JIRA HHH-11785 .

, @NotAudited, Envers . , , , .

:

@Entity
@Audited
class User {
  @Formula("SELECT name FROM Other ...")
  @NotAudited
  private String name;
  // other attributes
}
+6

Source: https://habr.com/ru/post/1678410/


All Articles