Skip to content
Browse files

HHH-7295 - Simplify ValidityAuditStrategy#perform() method

  • Loading branch information...
1 parent c8431ce commit 8211c97ace61499c3d7af98759bce87b3ab789c3 @lukasz-antoniak lukasz-antoniak committed May 30, 2012
View
13 hibernate-envers/src/main/java/org/hibernate/envers/strategy/ValidityAuditStrategy.java
@@ -91,12 +91,12 @@ public void perform(
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 Integer execute(Connection connection) throws SQLException {
"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) {

0 comments on commit 8211c97

Please sign in to comment.
Something went wrong with that request. Please try again.