From 01db71c2725fa99ae05773ce36d11b28dcdd2915 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 19 Jan 2023 16:02:28 +0100 Subject: [PATCH] HHH-16061 SqmDynamicInstantiation warns about dynamic Map instantiation when using an entity --- .../sqm/tree/select/SqmDynamicInstantiation.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java index fbc744e316..e9485c2fc7 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/SqmDynamicInstantiation.java @@ -171,13 +171,15 @@ public class SqmDynamicInstantiation } else if ( instantiationTarget.getNature() == MAP ) { // must(?) have an alias... - log.warnf( - "Argument [%s] for dynamic Map instantiation did not declare an 'injection alias' [%s] " + - "but such aliases are needed for dynamic Map instantiations; " + - "will likely cause problems later translating sqm", - argument.getSelectableNode().asLoggableText(), - argument.getAlias() - ); + if ( argument.getAlias() == null ) { + log.warnf( + "Argument [%s] for dynamic Map instantiation did not declare an 'injection alias' [%s] " + + "but such aliases are needed for dynamic Map instantiations; " + + "will likely cause problems later translating sqm", + argument.getSelectableNode().asLoggableText(), + argument.getAlias() + ); + } } if ( arguments == null ) {