You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
Activity
graphql-java#379 added extra readme documentation for causing mutations
bbakerman commentedon Apr 28, 2017
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
In the example above you need to get your JPA store and make updates based in input arguments
Merge pull request #394 from bbakerman/379-mutation-documentation
Merge remote-tracking branch 'upstream/master'