Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create Keyspace.java
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