Author: adamw
Date: 2008-08-14 05:12:11 -0400 (Thu, 14 Aug 2008)
New Revision: 98
Modified:
trunk/src/main/org/jboss/envers/query/impl/EntitiesAtRevisionQuery.java
Log:
ENVERS-35: only non-deleted entities are selected
Modified: trunk/src/main/org/jboss/envers/query/impl/EntitiesAtRevisionQuery.java
===================================================================
--- trunk/src/main/org/jboss/envers/query/impl/EntitiesAtRevisionQuery.java 2008-07-29
08:44:59 UTC (rev 97)
+++ trunk/src/main/org/jboss/envers/query/impl/EntitiesAtRevisionQuery.java 2008-08-14
09:12:11 UTC (rev 98)
@@ -23,6 +23,7 @@
import org.jboss.envers.reader.VersionsReaderImplementor;
import org.jboss.envers.query.criteria.VersionsCriterion;
+import org.jboss.envers.RevisionType;
import org.hibernate.criterion.*;
import java.util.List;
@@ -45,6 +46,7 @@
The query that should be executed in the versions table:
SELECT e FROM ent_ver e WHERE
(all specified conditions, transformed, on the "e" entity) AND
+ e.revision_type != DEL AND
e.revision = (SELECT max(e2.revision) FROM ent_ver e2 WHERE
e2.revision <= :revision AND e2.originalId.id = e.originalId.id)
*/
@@ -62,6 +64,8 @@
maxRevCriteria.add(versionsReader.getVerCfg().getIdMapper(entityName).getIdsEqualCriterion(
"e." + originalIdPropertyName, "e2." +
originalIdPropertyName));
+ // e.revision_type != DEL AND
+
versionsCriteria.add(Property.forName(versionsReader.getEntitiesCfg().getRevisionTypePropName()).ne(RevisionType.DEL));
// e.revision = (SELECT max(...) ...)
versionsCriteria.add(Property.forName(revisionPropertyPath).eq(maxRevCriteria));
// all specified conditions, transformed
Show replies by date