0

我是spring-data-cassandra第一次设置并有这样的课程:

@Table(value = "contact")
public class Contact {
    @Id
    UUID id;

    ...
    Location Location;
    ...

    public void setLocation(Location location) {
        this.location = location;
    }

    public Location getLocation() {
        return location;
    }
}

这在启动时给了我一个错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySQLTransactionRepository': Invocation of init method failed; nested exception is org.springframework.data.cassandra.mapping.VerifierMappingExceptions: com.foo.backend.core.Location:
Cassandra entities must have the @Table, @Persistent or @PrimaryKeyClass Annotation
....

来自spring-data-jpa背景的简单注释以前就足够了Location@Embeddable看起来这不适用于spring-data-cassandra. 如何使用复合实体spring-data-cassandra

是否必须自己注释location@Transient进行一些序列化?我试图用注释我的班级,@Persistent但收到关于PrimaryKey丢失的错误Location。我无法理解为什么需要主键...

4

1 回答 1

1

由于 Cassandra 的非关系细节,您会发现它不像 JPA 那样工作。

Cassandra 中没有连接,因此不允许将另一个表作为表的属性嵌入。

目前不支持可嵌入类型。如果您想详细说明功能请求,请为 SDC* 创建一个 Jira。

谢谢。

于 2014-06-17T14:42:51.063 回答