HHH-17104 More consistent function argument return type checking
This commit is contained in:
parent
8914f5bc65
commit
278ad6a109
|
@ -16,6 +16,7 @@ import org.hibernate.QueryException;
|
||||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||||
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
import org.hibernate.metamodel.mapping.JdbcMappingContainer;
|
||||||
|
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||||
import org.hibernate.query.ReturnableType;
|
import org.hibernate.query.ReturnableType;
|
||||||
import org.hibernate.query.sqm.SqmExpressible;
|
import org.hibernate.query.sqm.SqmExpressible;
|
||||||
import org.hibernate.query.sqm.SqmPathSource;
|
import org.hibernate.query.sqm.SqmPathSource;
|
||||||
|
@ -108,10 +109,9 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
ReturnableType<?> impliedType,
|
ReturnableType<?> impliedType,
|
||||||
List<? extends SqmTypedNode<?>> arguments,
|
List<? extends SqmTypedNode<?>> arguments,
|
||||||
TypeConfiguration typeConfiguration) {
|
TypeConfiguration typeConfiguration) {
|
||||||
for ( SqmTypedNode<?> arg : arguments ) {
|
for ( int i = 0; i < arguments.size(); i++ ) {
|
||||||
final SqmExpressible<?> argumentNodeType = arg != null ? getArgumentExpressible( arg ) : null;
|
if ( arguments.get( i ) != null ) {
|
||||||
if ( argumentNodeType instanceof ReturnableType ) {
|
final ReturnableType<?> argType = extractArgumentType( arguments, i + 1 );
|
||||||
ReturnableType<?> argType = (ReturnableType<?>) argumentNodeType;
|
|
||||||
return isAssignableTo( argType, impliedType ) ? impliedType : argType;
|
return isAssignableTo( argType, impliedType ) ? impliedType : argType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ public class StandardFunctionReturnTypeResolvers {
|
||||||
int position) {
|
int position) {
|
||||||
final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
final SqmTypedNode<?> specifiedArgument = arguments.get( position - 1 );
|
||||||
final SqmExpressible<?> specifiedArgType = getArgumentExpressible( specifiedArgument );
|
final SqmExpressible<?> specifiedArgType = getArgumentExpressible( specifiedArgument );
|
||||||
if ( !(specifiedArgType instanceof ReturnableType ) ) {
|
if ( specifiedArgType != null && !(specifiedArgType instanceof ReturnableType ) ) {
|
||||||
throw new QueryException(
|
throw new QueryException(
|
||||||
String.format(
|
String.format(
|
||||||
Locale.ROOT,
|
Locale.ROOT,
|
||||||
|
|
Loading…
Reference in New Issue