Question

I am trying to look up an object in my envers table, but I dont have the PK. Instead of the PK I have a field ("child") . This is my query,

List resultList = reader.createQuery().forRevisionsOfEntity(TP.class, false, true) .add(AuditEntity.property("child").eq(nodeid)).getResultList();

But I get this:

Caused by: org.hibernate.PropertyNotFoundException: field [id] not found on java.lang.Long

Or are there any chance of searching by custom fields for revisions?

Regards, Johann

Was it helpful?

Solution

If child is a relation, than you need to use AuditEntity.relatedId("child").eq(nodeid). See also 15.7.1 in the docs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top