|
16 | 16 | import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
17 | 17 | import org.hibernate.metamodel.mapping.JdbcMapping;
|
18 | 18 | import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
| 19 | +import org.hibernate.metamodel.model.domain.EntityDomainType; |
19 | 20 | import org.hibernate.query.ReturnableType;
|
20 | 21 | import org.hibernate.query.sqm.SqmExpressible;
|
21 | 22 | import org.hibernate.query.sqm.SqmPathSource;
|
@@ -108,10 +109,9 @@ public ReturnableType<?> resolveFunctionReturnType(
|
108 | 109 | ReturnableType<?> impliedType,
|
109 | 110 | List<? extends SqmTypedNode<?>> arguments,
|
110 | 111 | TypeConfiguration typeConfiguration) {
|
111 |
| - for ( SqmTypedNode<?> arg : arguments ) { |
112 |
| - final SqmExpressible<?> argumentNodeType = arg != null ? getArgumentExpressible( arg ) : null; |
113 |
| - if ( argumentNodeType instanceof ReturnableType ) { |
114 |
| - ReturnableType<?> argType = (ReturnableType<?>) argumentNodeType; |
| 112 | + for ( int i = 0; i < arguments.size(); i++ ) { |
| 113 | + if ( arguments.get( i ) != null ) { |
| 114 | + final ReturnableType<?> argType = extractArgumentType( arguments, i + 1 ); |
115 | 115 | return isAssignableTo( argType, impliedType ) ? impliedType : argType;
|
116 | 116 | }
|
117 | 117 | }
|
@@ -214,7 +214,7 @@ public static ReturnableType<?> extractArgumentType(
|
214 | 214 | int position) {
|
215 | 215 | final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
216 | 216 | final SqmExpressible<?> specifiedArgType = getArgumentExpressible( specifiedArgument );
|
217 |
| - if ( !(specifiedArgType instanceof ReturnableType ) ) { |
| 217 | + if ( specifiedArgType != null && !(specifiedArgType instanceof ReturnableType ) ) { |
218 | 218 | throw new QueryException(
|
219 | 219 | String.format(
|
220 | 220 | Locale.ROOT,
|
|
0 commit comments