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
parent 80360b1317
commit e1bcfc12cf

View File

@ -87,17 +87,14 @@ protected EntityLoadQueryDetails(
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() {