Skip to content

Instantly share code, notes, and snippets.

@cosbor11
Created April 2, 2017 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosbor11/87b2550591df0536f5142864f1c98829 to your computer and use it in GitHub Desktop.
Save cosbor11/87b2550591df0536f5142864f1c98829 to your computer and use it in GitHub Desktop.
Persist some data to see how it interacts with the Query Change Listener
// Add some data to see how the change listener reacts
Player tomBrady = new Player();
tomBrady.setFirstName("Tom");
tomBrady.setLastName("Brady");
tomBrady.setPosition("QB");
tomBrady.setHallOfFame(true);
// On Item Added should be fired
manager.saveEntity(tomBrady);
// He was ejected from the Hall of Fame because of Deflate gate.
tomBrady.setHallOfFame(false);
// See that he was removed from the result set and teh onItemRemoved was fired.
manager.saveEntity(tomBrady);
// Modify an entity and save, the onItemUpdated should be fired
johnElway.setDidNotCheat(true);
manager.saveEntity(johnElway);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment