Domanda

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

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top