From 8211c97ace61499c3d7af98759bce87b3ab789c3 Mon Sep 17 00:00:00 2001 From: Lukasz Antoniak Date: Wed, 30 May 2012 18:49:40 +0200 Subject: [PATCH] HHH-7295 - Simplify ValidityAuditStrategy#perform() method --- .../envers/strategy/ValidityAuditStrategy.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/strategy/ValidityAuditStrategy.java b/hibernate-envers/src/main/java/org/hibernate/envers/strategy/ValidityAuditStrategy.java index 6e12263b36..9d286cce1e 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/strategy/ValidityAuditStrategy.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/strategy/ValidityAuditStrategy.java @@ -91,12 +91,12 @@ public class ValidityAuditStrategy implements AuditStrategy { final SessionImplementor sessionImplementor = (SessionImplementor) session; final Dialect dialect = sessionImplementor.getFactory().getDialect(); + // Save the audit data + session.save(auditedEntityName, data); + sessionCacheCleaner.scheduleAuditDataRemoval(session, data); + // Update the end date of the previous row if this operation is expected to have a previous row if (getRevisionType(auditCfg, data) != RevisionType.ADD) { - // Save the audit data - session.save(auditedEntityName, data); - sessionCacheCleaner.scheduleAuditDataRemoval(session, data); - final Queryable productionEntityQueryable = getQueryable( entityName, sessionImplementor ); final Queryable rootProductionEntityQueryable = getQueryable( productionEntityQueryable.getRootEntityName(), sessionImplementor ); final Queryable auditedEntityQueryable = getQueryable( auditedEntityName, sessionImplementor ); @@ -216,12 +216,7 @@ public class ValidityAuditStrategy implements AuditStrategy { "Cannot update previous revision for entity " + auditedEntityName + " and id " + id ); } - return; } - - // Save the audit data - session.save(auditedEntityName, data); - sessionCacheCleaner.scheduleAuditDataRemoval(session, data); } private Queryable getQueryable(String entityName, SessionImplementor sessionImplementor) {