【发布时间】:2015-10-25 11:07:44
【问题描述】:
您能否提供一个使用 datastax api 注释映射集合以使用 Map 的示例。
class pojo {
@PartitionKey(value = 0)
@Column(name = "user_id")
String userId;
@Column(name = "attributes")
// How to map it
Map<String, String> attributes;
}
错误日志:
2015-08-03 16:33:34,568 INFO com.jpma.jpmc.slot.persistance.DAOFactory main - Cassandra Cluster Details: ConnectionCfg [userName=test, password=test, port=9042, seeds=[Ljava.lang.String;@1a85bd75, keySpace=test]
java.lang.Class
2015-08-03 16:33:34,646 DEBUG com.datastax.driver.mapping.EntityMapper main - Preparing query INSERT INTO "test"."user_event_date"("user_id","entry_date","entry_time","app","attributes","user_ip","user_authschemes") VALUES (?,?,?,?,?,?,?);
com.datastax.driver.core.exceptions.InvalidQueryException: Unknown identifier attributes
【问题讨论】:
-
你能分享你的'create table' cql 吗?这可能只是抱怨没有“属性”列。驱动程序将为您声明的模型的结果为每个查询创建准备好的语句,看起来服务器正在拒绝这个。
-
是的,你的问题解决了。
标签: java dictionary cassandra cql3 datastax-java-driver