You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Kenji Fnu <ke...@gmail.com> on 2015/10/19 05:50:30 UTC

Map of UDT Using Spring Cassandra

I created a user defined type in cassandra, let's call it
param that has key text, value text as its property
and
stats with value int, events int and users int as its property.

recently i tried to insert data using spring-cassandra driver, its got me
this error:
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'insertParam': Injection of autowired dependencies failed;
nested exception is
org.springframework.beans.factory.BeanCreationException: Could not autowire
field: private com.test.repository.ParamRepository
com.test.service.impl.insertParam.ParamRepository; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'ParamRepository': Invocation of init method failed; nested
exception is
org.springframework.data.cassandra.mapping.VerifierMappingExceptions:
com.test.model.CassandraEventStatsModel:
Cassandra entities must have the @Table, @Persistent or @PrimaryKeyClass
Annotation

inside the eventstatsmodel class:
package technology.mainspring.mscassandra.model;

import com.datastax.driver.mapping.annotations.Field;
import com.datastax.driver.mapping.annotations.UDT;

@UDT(keyspace = "com_test", name = "stats")
public class CassandraEventStatsModel {
@Field(name = "value")
public double value;
@Field(name = "events")
public int total_event;
@Field(name = "users")
public int total_uniq_user;
public double getValue(){
return value;
}
public int getTotalEvent(){
return total_event;
}
public int getTotalUniqueUser(){
return total_uniq_user;
}
public void setValue(double value){
this.value = value;
}
public void setTotalEvent(int total_event){
this.total_event = total_event;
}
public void setTotalUniqueUser(int total_uniq_user){
this.total_uniq_user = total_uniq_user;
}
}

i wonder what i did wrong? thanks