Skip to content

Instantly share code, notes, and snippets.

@eevans
Last active December 28, 2015 11:08
Show Gist options
  • Save eevans/7490860 to your computer and use it in GitHub Desktop.
Save eevans/7490860 to your computer and use it in GitHub Desktop.
...
// Create a factory, and an instance of EntityStore
EntityStoreFactory factory = new CassandraEntityStoreFactory("127.0.0.1", 9042, ConsistencyLevel.QUORUM);
EntityStore store = factory.createEntityStore();
// Create a new user
User peter = new User("Peter", "Griffin", "[email protected]");
store.create(peter);
...
// Read a user
Optional<User> result = store.read(User.class, pID);
if (result.isPresent()) {
User p = result.get();
p.setEmailAddress("[email protected]");
// Update
store.update(p);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment