HHH-11892 - Fix loading audit history when using a map with entity-type keys.

This commit is contained in:
Chris Cranford 2017-08-22 15:53:44 -04:00
parent 39196915f1
commit e992ff04c9
1 changed files with 6 additions and 6 deletions

View File

@ -96,10 +96,10 @@ public final class ThreeEntityQueryGenerator extends AbstractRelationQueryGenera
final QueryBuilder removedQuery = commonPart.deepCopy();
createValidDataRestrictions(
globalCfg, auditStrategy, referencedIdData, versionsMiddleEntityName, validQuery,
validQuery.getRootParameters(), true, componentData
validQuery.getRootParameters(), true, indexIdData, componentData
);
createValidAndRemovedDataRestrictions(
globalCfg, auditStrategy, referencedIdData, versionsMiddleEntityName, removedQuery, componentData
globalCfg, auditStrategy, referencedIdData, versionsMiddleEntityName, removedQuery, indexIdData, componentData
);
queryString = queryToString( validQuery );
@ -144,7 +144,7 @@ public final class ThreeEntityQueryGenerator extends AbstractRelationQueryGenera
private void createValidDataRestrictions(
GlobalConfiguration globalCfg, AuditStrategy auditStrategy,
MiddleIdData referencedIdData, String versionsMiddleEntityName, QueryBuilder qb,
Parameters rootParameters, boolean inclusive, MiddleComponentData... componentData) {
Parameters rootParameters, boolean inclusive, MiddleIdData indexIdData, MiddleComponentData... componentData) {
final String revisionPropertyPath = verEntCfg.getRevisionNumberPath();
final String originalIdPropertyName = verEntCfg.getOriginalIdPropName();
final String eeOriginalIdPropertyPath = MIDDLE_ENTITY_ALIAS + "." + originalIdPropertyName;
@ -174,7 +174,7 @@ public final class ThreeEntityQueryGenerator extends AbstractRelationQueryGenera
INDEX_ENTITY_ALIAS + "." + revisionPropertyPath,
INDEX_ENTITY_ALIAS + "." + verEntCfg.getRevisionEndFieldName(),
false,
referencedIdData,
indexIdData,
revisionPropertyPath,
originalIdPropertyName,
INDEX_ENTITY_ALIAS,
@ -212,7 +212,7 @@ public final class ThreeEntityQueryGenerator extends AbstractRelationQueryGenera
private void createValidAndRemovedDataRestrictions(
GlobalConfiguration globalCfg, AuditStrategy auditStrategy,
MiddleIdData referencedIdData, String versionsMiddleEntityName,
QueryBuilder remQb, MiddleComponentData... componentData) {
QueryBuilder remQb, MiddleIdData indexIdData, MiddleComponentData... componentData) {
final Parameters disjoint = remQb.getRootParameters().addSubParameters( "or" );
// Restrictions to match all valid rows.
final Parameters valid = disjoint.addSubParameters( "and" );
@ -222,7 +222,7 @@ public final class ThreeEntityQueryGenerator extends AbstractRelationQueryGenera
final String revisionTypePropName = getRevisionTypePath();
// Excluding current revision, because we need to match data valid at the previous one.
createValidDataRestrictions(
globalCfg, auditStrategy, referencedIdData, versionsMiddleEntityName, remQb, valid, false, componentData
globalCfg, auditStrategy, referencedIdData, versionsMiddleEntityName, remQb, valid, false, indexIdData, componentData
);
// ee.revision = :revision
removed.addWhereWithNamedParam( revisionPropertyPath, "=", REVISION_PARAMETER );