I am trying to insert byte array into Blob data type in my Cassandra table.. I am using Datastax Java driver. Below is my code -
for (Map.Entry<String, byte[]> entry : attributes.entrySet()) {
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
String cql = "insert into test_data (user_id, name, value) values ('"+userId+"', '"+entry.getKey()+"', '"+entry.getValue()+"');";
System.out.println(cql);
CassandraDatastaxConnection.getInstance();
CassandraDatastaxConnection.getSession().execute(cql);
}
And this is the exception I am getting back -
InvalidQueryException: cannot parse '[B@50908fa9' as hex bytes
I guess the problem is, the way I am making my above cql.. Something is missing for sure...
I have created the table like this -
create table test_data (user_id text, name text, value blob, primary key (user_id, name));
Can anybody help me? Thanks...