HHH-12594 Do not share AliasResolutionContextImpl between EntityLoadQueryDetails instances

Sharing it results in some tables being aliased twice for the same query
space, but with different aliases, resulting in exceptions.

Ideally we should try to generate the aliases once, and then share the
AliasResolutionContextImpl between EntityLoadQueryDetails instances,
but I'm really not comfortable enough with this code to make that kind
of changes.
This commit is contained in:
Yoann Rodière 2018-06-25 15:17:25 +02:00 committed by Guillaume Smet
parent ebda68958d
commit 4a53df0dd3
1 changed files with 4 additions and 7 deletions

View File

@ -87,17 +87,14 @@ public class EntityLoadQueryDetails extends AbstractLoadQueryDetails {
protected EntityLoadQueryDetails(
EntityLoadQueryDetails initialEntityLoadQueryDetails,
QueryBuildingParameters buildingParameters) {
super(
this(
initialEntityLoadQueryDetails.getLoadPlan(),
(AliasResolutionContextImpl) initialEntityLoadQueryDetails.getAliasResolutionContext(),
buildingParameters,
initialEntityLoadQueryDetails.getKeyColumnNames(),
initialEntityLoadQueryDetails.getRootReturn(),
new AliasResolutionContextImpl( initialEntityLoadQueryDetails.getSessionFactory() ),
(EntityReturn) initialEntityLoadQueryDetails.getRootReturn(),
buildingParameters,
initialEntityLoadQueryDetails.getSessionFactory()
);
this.entityReferenceAliases = initialEntityLoadQueryDetails.entityReferenceAliases;
this.readerCollector = initialEntityLoadQueryDetails.readerCollector;
generate();
}
private EntityReturn getRootEntityReturn() {