java - How to store Enum into Cassandra with Springdata? -


i trying store enum cassandra using springdata framework. possible? have defined enum:

    public enum currency {         gbp,          usd,          eur     } 

then define class "@enumerated" annotation on field:

@table public class bondstatic {      @primarykey     private string id;      private string isin;     private string ticker;     private date maturity;     private double coupon;     @enumerated(enumtype.string)     private currency currency;     ... 

these imports:

import com.datastax.driver.mapping.enumtype; import com.datastax.driver.mapping.annotations.enumerated; 

then have component class spring:

@component class cassandradataclr implements commandlinerunner {      @autowired     public bondstaticcassandrarepository bondstaticrepository;     ... 

which autowired from:

@repositoryrestresource(path = "/bond-static") interface bondstaticcassandrarepository extends cassandrarepository<bondstatic> {  } 

where these imports:

import org.springframework.data.cassandra.repository.cassandrarepository; import org.springframework.data.rest.core.annotation.repositoryrestresource; 

but when try run following:

    bondstaticrepository.save(bondstatics); 

i get:

value 0 of type class pojo.pocenums$currency not correspond cql3 type 

any suggestions? simple solution make fields string , use enum in getter , setter, seems having annotated enum cleaner solution if can work.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -