0

I have the following user defined type in cassandra:

CREATE TYPE key(
    name text,
    created_time timestamp
);

It goes in the following table:

CREATE TABLE keys(
    id uuid,
    keys map<text, frozen<list<key>>>
);

** Note that the below POJOS also contain setters/getters, snipped for readability**

Then I have the following POJO for mapping for key:

@UserDefinedType(value = "key")
public class MyKey {
    @Column(value = "name")
    private String name;
    @Column(value = "created_time")
    private Instant createdTime;
}

I have the following POJO for keys

@Table(value = "keys")
public class MyKeys {
    @PrimaryKey(value = "id")
    private UUID id;
    @Column(value = "keys")
    private Map<String, List<Key>> keys;
}

Unfortunately when I try to insert an instance of MyKeys I get the following error:

org.springframework.dao.InvalidDataAccessApiUsageException: Only primitive types are allowed inside Collections for property [keys] of type [interface java.util.Map] in entity [com.utx.dao.tables.MyKeys]

Does the Spring-Data-Cassandra mapper not work with maps of user defined types, and if not, is there a solution to my problem?

withoutclass
  • 564
  • 8
  • 16

0 Answers0