Im asking for the possibility to create a table in cassandra that contains a List of Map! like that:
CREATE TABLE IF NOT EXISTS agence(
id timeuuid,
code text,
libelle text,
adresse set<frozen<map<text,text>>>,
conseillers set<frozen<map<text,text>>>,
compagnie_id timeuuid,
...
In spring Data I have this query:
findAll()
then I got this error:
Query; CQL [SELECT * FROM agence;]; Codec not found for requested operation: [map<varchar, varchar> <-> java.util.Map]
I dont know if there is a bad configuration or bad use of cassandra!!
Anyone has suggestion please?
Finally I get a solution:
/** The conseillers. */
@Column(value = "conseillers")
@Frozen
@FrozenKey
@FrozenValue
private Set<Map<String, String>> conseillers;
Like this we can map map <-> java.util.Map
for(Row row : cassandraOperations.select("SELECT conseillers FROM agence", Row.class)){
Set<Map<String, String>> info = mapperCassandra(row, "conseillers");
}
}
private Set<Map<String, String>> mapperCassandra(Row row, String type) {
return row.getSet(type, TypeTokens.mapOf(TypeToken.of(String.class), TypeToken.of(String
.class)));
}