Created
May 1, 2019 11:48
-
-
Save ThakurPriyanka/97ab27cd07e37a95027f9ce584f60547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public <T> boolean deleteNode(final T element) { | |
try (Transaction txn = dgraphClient.newTransaction()) { | |
try { | |
final DgraphProto.Mutation mutation = getDeleteMutation(element); | |
txn.mutate(mutation); | |
txn.commit(); | |
return true; | |
} catch (StatusRuntimeException | TxnConflictException | JsonProcessingException dgraphException) { | |
txn.discard(); | |
throw new RuntimeException("Unable to persist the transaction ", dgraphException); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment