자바 카산드라지도 유형을 사용하는 방법

크리슈나 :

나는 같은 키 스페이스에서 테이블을 만들었습니다

CREATE TABLE IF NOT EXISTS myks.users (user_id text, device_ids map<text,text>);

I'm trying to insert the below data using `spring-boot-starter-data-cassandra` library in Spring boot

{
    "userId" : "krishna",
    "deviceIds": {
        "DeviceId_0": "TYNLSANID7",
        "DeviceId_1": "julasjasd8",
        "DeviceId_2": "iu89074hasd",
        "DeviceId_3": "Lenovo hjyas|asdqnkasd"
    }
}

아래의 엔티티 클래스

@Column("user_id")
@CassandraType(type = DataType.Name.TEXT)
private String userId;

@Column("device_ids")
@CassandraType(type = DataType.Name.MAP)
private Map<String, String> deviceIds= new HashMap<>();

테이블에 데이터를 삽입 할 때 나는 예외 아래를 받고 있어요

org.springframework.dao.InvalidDataAccessApiUsageException: Expected [2] type arguments for property ['deviceIds'] of type ['interface java.util.Map'] in entity [com.kri.entity.Users]; actual was [0]
Niver :

에 지정된대로 문서 당신은 제공해야 typeArguments당신이 작업 할 때 주석 정의의 속성을 Collection, 및 특정의 Map데이터가 두 제공해야 입력 DataType Name특성, 키의 하나 resipectively 값 하나를 :

@CassandraType(type = DataType.Name.MAP,typeArguments = { DataType.Name.TEXT,DataType.Name.TEXT} 

추천

출처http://43.154.161.224:23101/article/api/json?id=335951&siteId=1