Last active
December 28, 2015 11:08
-
-
Save eevans/7490860 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
... | |
// 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