Skip to content

Create column family

jvalencia edited this page Nov 20, 2012 · 6 revisions
AstyanaxContext<Cluster> clusterContext = connectClusterContext(clusterName, port, hosts);
clusterContext.start();
ColumnFamilyDefinition cfDefinition = clusterContext.getEntity().makeColumnFamilyDefinition()
	.setKeyspace(ks)
	.setName(cfName)
	.setComparatorType("UTF8Type")
	.setKeyValidationClass("UTF8Type");

if (counter) {
	cfDefinition.setDefaultValidationClass("CounterColumnType");
}

try {
	clusterContext.getEntity().addColumnFamily(cfDefinition);
	//clusterContext.getEntity().updateColumnFamily(cfDefinition);
	return true;
} catch (ConnectionException exception) {
	System.out.println(exception.getMessage());
	return false;
}
Clone this wiki locally