Hello everyone,
I have a CQL3 table which I created like this:
CREATE TABLE element(
key1 UUID,
key2 UUID,
key3 UUID,
value1 text,
value2 blob,
value3 bigint,
PRIMARY KEY(key1, key2, key3));
I insert data using a mutator to which I add data like this:
private <U extends AbstractSerializer<T>, T> void addToMutator(UUID key1,
UUID key2, UUID key3, String name, T value, U serializer) {
Composite composite = new Composite();
composite.addComponent(key2, UUIDSerializer.get());
composite.addComponent(key3, UUIDSerializer.get());
composite.addComponent(name, StringSerializer.get());
HColumn<Composite, T> column = HFactory.createColumn(composite, value,
new CompositeSerializer(), serializer);
mutator.addInsertion(key1, "element", column);
}
Which requires calling this function 5 times (for every key but the first and every value).
I then execute the mutator.
Is there a better way of doing this with less overhead or maybe an easier way?
I also execute a range select over key3 with a SliceQuery<UUID, Composite, byte[]> which eventually gives me 5 HColumns consisting of a Composite (key1, key2, "<key of value>") and the actual value for each entry in the db which I then have to put in a HashMap<UUID, HashMap<String, byte[]>> to sort it.
Is there a way of doing this more effectively?
I thought about using the Hector Object Mapper but I don't know if it works with CQL3 and Composite keys and I did not find any information about this.