currently we're using HBase to store our data. Therefore we created an abstract class that holds a Map, and this map is then stored via the Java API. a sample class would be
class User extends AHBase {
public static String columnName = "nam".getBytes();
//...
public void setName(String name) {
values.put(columnName, name.getBytes());
}
public String getName() {
return new String(values.get(columnName));
}
public byte[] getColumnFamily() {...}
public byte[] getTable() {...}
}
and a store is as simple as (simplified)
public void store(AHbase a) {
List<Put> puts = new ArrayList<>();
for (Entry<byte[], byte[] item : a.getValues().entrySet()) {
Put p = new Put(a.getColumnFamily, item.getKey(), item.getValue());
puts.add(p);
}
//...
}
we are now evaluating Cassandra, as it's said to be also a key-value store and it should be easy to just switch and do some basic evaluation (at least we thought so).
But now when checking out the latest version of Cassandra (2.1.2) it's kind of not what we expected.
Is there still a simple way to store key-value pairs (for a ColumnFamily) with basic put operations or similar? I want to avoid having to define the column names in advance.