We introduced envers late in the project. This means we have many entities in our db which have not a single revision in their _AUD table. This causes these queries to fail with javax.persistence.EntityNotFoundException, if it happens to involve such entity, probably because there is no representation for that entity at that rev.
reader.createQuery().forRevisionsOfEntity(entity.getClass(), false, true).add(AuditEntity.id().eq(entity.getId())).getResultList();
I got this query to work, after manually inserting the missing entity in its _AUD table, with a rev smaller than the one i was querying for.
Is there a way to handle this problem: maybe some script to insert all missing entities with rev=0? Or a patch such that this EntityNotFoundException is handled by taking the "current" version for such entities?