Markus
Markus

Reputation: 4242

Cassandra and Hector = MultiGetSliceQuery, with Column-Values of various different types?

Hallo,

I do not understand, how to query cassandra with hector, but the column-values returned are not of one single type, but of many:

I put in ???? where I do not know what to do:

MultigetSliceQuery<String, String, ??????> multigetSliceQuery = HFactory.createMultigetSliceQuery(keyspace, stringSerializer, stringSerializer, ???????);

For for example, if all my column-values are of String type, I would put in String. But I have differnt ones like String, Integer, and byte[] in one single row. So I must pass in more then one Serializer.

How to solve this?

Thank you.

(can one pls create hector as tag? I am not allowed to do this)

Upvotes: 3

Views: 2639

Answers (2)

zznate
zznate

Reputation: 1908

We provide arbitrary typing via a template-method pattern. See the test case: https://github.com/rantav/hector/blob/master/core/src/test/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplateTest.java

The new getting started guide should be helpful as well: https://github.com/rantav/hector/wiki/Getting-started-%285-minutes%29

Upvotes: 6

sbridges
sbridges

Reputation: 25140

You can use the ByteBufferSerializer, and then convert the ByteBuffers returned from ByteBufferSerializer as the argument to StringSerializer and IntegerSerializer to convert the columns which are Strings and Integers.

Upvotes: 5

Related Questions