-
1. Re: Deleted entities when querying for entities at revision
adamw Jun 17, 2011 3:20 AM (in response to anonimo)I think you should rather use the revisions-of-entity query.
First you get the bounding revisions:
Number startRevision = reader.getRevisionNumberForDate(startDate);
Number enRevision = reader.getRevisionNumberForDate(endDate);
Then you do the query:
reader.createQuery.forRevisionsOfEntity(PC.class, true, true)
.add(AuditEntity.revisionNumber().ge(startRevision)
.add(AuditEntity.revisionNumber().le(endRevision));
Adam
-
2. Re: Deleted entities when querying for entities at revision
slominskir Jun 22, 2011 2:22 PM (in response to adamw)I would also like to just query for a specific revision of an entity, and include deleted ones. I have a method that takes an entity Id and revision Id and uses the forEntitiesAtRevision query. It appears to work for all cases except when the revision represents a delete. In that case I get a javax.persistence.NoResultException and upon inspection of the SQL that is generated I see that there is a where REVTYPE<>2 condition. Why is this condition present? Is this a bug?
The workaround of using forRevisionsOfEntity does work though.
-
3. Re: Deleted entities when querying for entities at revision
adamw Jun 27, 2011 11:09 AM (in response to slominskir)Yes, well, maybe not really a bug, just the API lacks the possibility to create an appropriate query. So rather an overlooked feature
Adam