@@ -309,15 +309,11 @@ protected Predicate getPredicate(CriteriaBuilder cb, Root<?> from, From<?,?> pat
309309
310310 From <?,?> join = getCompoundJoin (path , argument .getName (), true );
311311 Argument where = new Argument ("where" , argument .getValue ());
312- Map <String , Object > variables = Optional .ofNullable (environment .getContext ())
313- .filter (it -> it instanceof Map )
314- .map (it -> (Map <String , Object >) it )
315- .map (it -> (Map <String , Object >) it .get ("variables" ))
316- .orElse (Collections .emptyMap ());
312+ Map <String , Object > variables = environment .getExecutionContext ().getVariables ();
317313
318314 GraphQLFieldDefinition fieldDef = getFieldDef (
319315 environment .getGraphQLSchema (),
320- this .getObjectType (environment , argument ),
316+ this .getObjectType (environment ),
321317 new Field (fieldName )
322318 );
323319
@@ -420,7 +416,7 @@ private Predicate getFieldPredicate(String fieldName, CriteriaBuilder cb, From<?
420416 .anyMatch (it -> !Logical .names ().contains (it .getName ()) && !Criteria .names ().contains (it .getName ())))
421417 {
422418 GraphQLFieldDefinition fieldDefinition = getFieldDef (environment .getGraphQLSchema (),
423- this .getObjectType (environment , argument ),
419+ this .getObjectType (environment ),
424420 new Field (fieldName ));
425421 Map <String , Object > arguments = new LinkedHashMap <>();
426422 boolean isOptional = false ;
@@ -580,7 +576,9 @@ protected Object convertValue(DataFetchingEnvironment environment, Argument argu
580576 }
581577 else if (value instanceof VariableReference ) {
582578 Class javaType = getJavaType (environment , argument );
583- Object argumentValue = environment .getArguments ().get (argument .getName ());
579+ Object argumentValue = environment .getExecutionContext ()
580+ .getVariables ()
581+ .get (VariableReference .class .cast (value ).getName ());
584582 if (javaType .isEnum ()) {
585583 if (argumentValue instanceof Collection ) {
586584 List <Enum > values = new ArrayList <>();
@@ -660,7 +658,7 @@ protected Class<?> getJavaType(DataFetchingEnvironment environment, Argument arg
660658 * @return JPA model attribute
661659 */
662660 private Attribute <?,?> getAttribute (DataFetchingEnvironment environment , Argument argument ) {
663- GraphQLObjectType objectType = getObjectType (environment , argument );
661+ GraphQLObjectType objectType = getObjectType (environment );
664662 EntityType <?> entityType = getEntityType (objectType );
665663
666664 return entityType .getAttribute (argument .getName ());
@@ -697,7 +695,7 @@ private EntityType<?> getEntityType(GraphQLObjectType objectType) {
697695 * @param argument
698696 * @return resolved GraphQL object type or null if no output type is provided
699697 */
700- private GraphQLObjectType getObjectType (DataFetchingEnvironment environment , Argument argument ) {
698+ private GraphQLObjectType getObjectType (DataFetchingEnvironment environment ) {
701699 GraphQLType outputType = environment .getFieldType ();
702700
703701 if (outputType instanceof GraphQLList )
0 commit comments