我是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
。我无法理解为什么需要主键...