Envers return AuditReaderFactory 查询复合 属性 上的 QueryException
Envers return QueryException on AuditReaderFactory query composite property
Envers 在嵌入式 class 中找不到复合 属性 已审核。我有:
@Embeddable
public class Allocation {
private Long value;
...
}
@Entity
@Table(name = "payment")
@Audited
@AuditTable(value="payment_allocation")
public class PaymentEntity extends AbstractEntity {
// All propert is not Audited except Allocation
@Embedded
@NotAudited
private Transaction transaction;
@Audited
@Embedded
private Allocation allocation;
...
}
所以当我打电话时:
AuditReaderFactory
.get(entityManager)
.createQuery()
.forRevisionsOfEntity(PaymentEntity.class, true, true)
.add(AuditEntity.property("allocation.value").eq(1l))
.getResultList();
我有一个
org.hibernate.QueryException:无法解析 属性:分配:....PaymentEntity_AUD
我只试了 "value",我遇到了同样的异常。
我想要价值为 1L 的所有付款的历史记录。因此,访问复合 属性 就像我们构建查询时有一些不同?
所以,我找到了解决方案:https://hibernate.atlassian.net/browse/HHH-9178
属性 的名字不是 "allocation.value",而是 "allocation_value"。
Envers 在嵌入式 class 中找不到复合 属性 已审核。我有:
@Embeddable
public class Allocation {
private Long value;
...
}
@Entity
@Table(name = "payment")
@Audited
@AuditTable(value="payment_allocation")
public class PaymentEntity extends AbstractEntity {
// All propert is not Audited except Allocation
@Embedded
@NotAudited
private Transaction transaction;
@Audited
@Embedded
private Allocation allocation;
...
}
所以当我打电话时:
AuditReaderFactory
.get(entityManager)
.createQuery()
.forRevisionsOfEntity(PaymentEntity.class, true, true)
.add(AuditEntity.property("allocation.value").eq(1l))
.getResultList();
我有一个
org.hibernate.QueryException:无法解析 属性:分配:....PaymentEntity_AUD
我只试了 "value",我遇到了同样的异常。
我想要价值为 1L 的所有付款的历史记录。因此,访问复合 属性 就像我们构建查询时有一些不同?
所以,我找到了解决方案:https://hibernate.atlassian.net/browse/HHH-9178
属性 的名字不是 "allocation.value",而是 "allocation_value"。