HHH-11770 - Fix for audited queries for OneToMany associated to an EmbeddedId property.

This commit is contained in:
Chris Cranford 2017-05-24 19:59:12 -04:00
parent 10e69bd7b2
commit a7f77e2687
1 changed files with 4 additions and 2 deletions

View File

@ -8,8 +8,8 @@ package org.hibernate.envers.internal.entities.mapper.relation.query;
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration; import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
import org.hibernate.envers.configuration.internal.GlobalConfiguration; import org.hibernate.envers.configuration.internal.GlobalConfiguration;
import org.hibernate.envers.internal.entities.mapper.id.AbstractCompositeIdMapper;
import org.hibernate.envers.internal.entities.mapper.id.IdMapper; import org.hibernate.envers.internal.entities.mapper.id.IdMapper;
import org.hibernate.envers.internal.entities.mapper.id.MultipleIdMapper;
import org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData; import org.hibernate.envers.internal.entities.mapper.relation.MiddleIdData;
import org.hibernate.envers.internal.tools.query.Parameters; import org.hibernate.envers.internal.tools.query.Parameters;
import org.hibernate.envers.internal.tools.query.QueryBuilder; import org.hibernate.envers.internal.tools.query.QueryBuilder;
@ -47,7 +47,9 @@ public final class OneAuditEntityQueryGenerator extends AbstractRelationQueryGen
this.mappedBy = mappedBy; this.mappedBy = mappedBy;
if ( ( referencedIdData.getOriginalMapper() instanceof MultipleIdMapper ) && mappedByKey ) { // HHH-11770 We use AbstractCompositeIdMapper here to handle EmbeddedIdMapper and MultipleIdMappper support
// so that OneAuditEntityQueryGenerator supports mappings to both @IdClass and @EmbeddedId components.
if ( ( referencedIdData.getOriginalMapper() instanceof AbstractCompositeIdMapper ) && mappedByKey ) {
multipleIdMapperKey = true; multipleIdMapperKey = true;
} }
else { else {