Created
October 29, 2014 17:01
-
-
Save mp911de/ea5de9f1f3ef6a873307 to your computer and use it in GitHub Desktop.
Create Keyspace.java
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
Session adminSession = cluster.connect(); | |
BasicCassandraMappingContext cmp = new BasicCassandraMappingContext(); | |
cmp.setInitialEntitySet(ImmutableSet.of(...)); | |
cmp.initialize(); | |
CassandraConverter cassandraConverter = new MappingCassandraConverter(cmp); | |
CassandraAdminTemplate admin = new CassandraAdminTemplate(adminSession, cassandraConverter); | |
CreateKeyspaceSpecification keyspace = new CreateKeyspaceSpecification(cassandraKeyspaceName); | |
keyspace.ifNotExists().withSimpleReplication(2); | |
admin.execute(keyspace); | |
adminSession.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment