类java.util.LinkedHashMap的值0与任何CQL3类型都不对应

时间:2016-02-24 05:08:39

标签: cassandra spring-data-cassandra

我正在尝试使用Cassandra存储库将spring实体保存到Cassandra(2.0.11)。实体类如下:

    @Table(value="gs")
    public class GsJsonStore implements Serializable {
        private static final long serialVersionUID = 7133072282172062535L;
        @PrimaryKey
        private String id;
        @Column(value = "object")
        @CassandraType(type=DataType.Name.MAP)
        private Map<String, String> _object;
        @Column(value = "subject")
        private String _subject;
       //Getter and Setter methods.
    }

我用来保存对象的代码:

    GsJsonStore gsJsonStore = new GsJsonStore();
    gsJsonStore.setPredicate("Predicate");
    gsJsonStore.setSubject("Subject");
    gsJsonStore.setObject(jsonToMap(jsonNode));
    repository.save(gsJsonStore);

jsonToMap函数:

    public Map<String,String> jsonToMap(JsonNode json) {
    ObjectMapper mapper = new ObjectMapper();
    Map<String, String> result = mapper.convertValue(json, Map.class);
    return result;
    }

存储对象时出现以下错误: java.lang.IllegalArgumentException:

Value 0 of type class java.util.LinkedHashMap does not correspond to any CQL3 type

我哪里错了?

0 个答案:

没有答案