Hi
To create:
ColumnFamilyDefinition counters = createBasicCfDef(
KEYSPACE, Consts.COUNTERS, ComparatorType.UTF8TYPE,
null, "CounterColumnType", "CompositeType(UTF8Type,UUIDType)");
counters.setReplicateOnWrite(true);
cluster.addColumnFamily(counters, true);
to increment (add) counter
public static void incrementCounter(Composite key,
String columnName, long inc) {
Mutator<Composite> mutator =
HFactory.createMutator(keyspace,
CompositeSerializer.get());
mutator.incrementCounter(key,
Consts.COUNTERS, columnName, inc);
mutator.execute();
}
Regards,
*Tamar Fraenkel *
Senior Software Engineer, TOK Media
[image: Inline image 1]
[email protected]
Tel: +972 2 6409736
Mob: +972 54 8356490
Fax: +972 2 5612956
On Wed, Jul 25, 2012 at 8:24 PM, Amila Paranawithana <[email protected]>wrote:
>
> Hi all,
>
> I want to create counter columns in a column family via a java module.
> These column families and counter columns need to be created dynamically.
> plz send me some example codes to refer. (with hector or any other method
> )
>
> Thanks
> --
> Amila Iroshani Paranawithana
> CSE-University of Moratuwa.
> B-http://amilaparanawithana.blogspot.com
> T-https://twitter.com/#!/AmilaPara
>
>
>
<<tokLogo.png>>
