在Spring数据上应用UDT

时间:2015-10-16 11:37:39

标签: java cassandra spring-data

我在cassandra中创建了自定义类型,我正在尝试使用spring插入数据。起初我认为使用这样的实体会起作用:

@PrimaryKeyColumn(name = "appid", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
private String appid;
@PrimaryKeyColumn(name = "event", ordinal = 1, type = PrimaryKeyType.PARTITIONED, ordering = Ordering.ASCENDING)
private String event;
@PrimaryKeyColumn(name = "date", ordinal = 2, type = PrimaryKeyType.CLUSTERED, ordering = Ordering.DESCENDING)
private Date date;
@PrimaryKeyColumn(name = "userid", ordinal = 3, type = PrimaryKeyType.PARTITIONED)
private String userid;
@Column (name = "items")
@Frozen
private Map<CassandraEventParamModel,CassandraEventStatsModel> items;

在java中创建了一个UDT(创建类型的参数):

@UDT(keyspace = "ms_analytics", name = "param")
public class CassandraEventParamModel {
    @Field(name = "key")
    public String key;
    @Field(name = "value")
    public String value;

但我不断收到错误消息

 Invocation of init method failed; nested exception is org.springframework.data.cassandra.mapping.VerifierMappingExceptions:
Cassandra entities must have the @Table, @Persistent or @PrimaryKeyClass Annotation

我想知道使用spring-data将数据传递到cassandra的正确方法是什么。

由于

0 个答案:

没有答案