J'installe spring-data-cassandra
pour la première fois et ont une classe comme ceci:Comment utiliser l'entité composite dans 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;
}
}
Cela me donne une erreur lors du démarrage:
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
....
Issu d'un milieu spring-data-jpa
annoter simplement Location
avec @Embeddable
a déjà été suffisant. Il semble que cela ne fonctionne pas avec spring-data-cassandra
. Comment utiliser les entités composées avec spring-data-cassandra
?
Je devrai annoter location
en tant que @Transient
et effectuer une sérialisation moi-même? J'ai essayé d'annoter ma classe avec @Persistent
mais obtenait une erreur au sujet de PrimaryKey
manquant sur Location
. Je ne comprends pas pourquoi une clé primaire serait nécessaire ...
Demande de fonctionnalité: https://github.com/spring-projects/spring-data-cassandra/issues/16 – Ztyx