1

I am doing the query like this:

    GraphQLQueryRequest req = new GraphQLQueryRequest(query, projection);
    String serialized = req.serialize();
    GraphQLResponse response = getClient().executeQuery(serialized);

The response seems to be prepared to return multiple entities. How do I request multiple queries?

Thiago Sayão
  • 2,197
  • 3
  • 27
  • 41

1 Answers1

1

If you are try to call the same query twice or more, you should use an alias e.g.:

        this.dgsQueryExecutor.execute("""
                {
                    request1 : doctor {
                     id
                     name
                   },
                    request2 : doctor {
                     id
                     name
                   }
                }
                """);

Otherwise, you can just call two queries like:

        this.dgsQueryExecutor.execute("""
                {
                    doctor {
                     id
                     name
                   },
                    patient {
                     id
                     name
                   }
                }
                """);