Skip to content

To achieve graphql mutation #379

Closed
Closed

Description

@NoyalThomas

How to achieve graphql mutation using spring boot. I have already implemented the query type schema with postgres database(jpa) and its working fine. I want to know how to create mutation type schema postgres database(jpa)
Plz help me in this

Activity

  1. added a commit that references this issue on Apr 28, 2017
  2. bbakerman commented on Apr 28, 2017

    @bbakerman
    Member

    In essence you need to have a type that takes arguments and a data fetcher that causes an mutation to you data store via jpa.

    I am not going to go into how to make a JPA update. How you wire your mutating data fetchers together is up to you.

    I realised the data readme is sparse in terms of mutation examples and hence I have expanded it

    #394

    new DataFetcher() {
            @Override
            public Review get(DataFetchingEnvironment environment) {
                Episode episode = environment.getArgument("episode");
                ReviewInput review = environment.getArgument("review");
    
                // make a call to your store to mutate your database
                Review updatedReview = reviewStore().update(episode, review);
    
                // this returns a new view of the data
                return updatedReview;
            }
        }
    

    In the example above you need to get your JPA store and make updates based in input arguments

  3. added a commit that references this issue on May 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions