UDT Maps not supported by Spring

318 views
Skip to first unread message

ravi ch

unread,
Oct 5, 2017, 2:44:46 AM10/5/17
to DataStax Java Driver for Apache Cassandra User Mailing List

I defined the below type and table in cassandra for persisting some information.


CREATE TYPE attributes (

    value text,

    operator text,

    dataType text

);


CREATE TABLE management.meta (

    type varchar,

    values map<text, frozen <list< attributes >>>,

    PRIMARY KEY (type)

);


I'm getting error ""Only primitive types are allowed inside Collections for property [values] of type ['interface java.util.Map'] in entity" when I define a entity to perform CRUD operation. We are using com.datastax.cassandra 3.1.4 version. Below is my entity definition:


@CassandraType(type = DataType.Name.MAP, typeArguments = {DataType.Name.TEXT, DataType.Name.UDT}, userTypeName = "attributes")

 private Map<String, List<RulesAttributesType>> values;


    @UserDefinedType("attributes")

    public static class AttributesType {

        @CassandraType(type = DataType.Name.TEXT)

        private String value;

        @CassandraType(type = DataType.Name.TEXT)

        private String operator;

        @CassandraType(type = DataType.Name.TEXT)

        private String dataType;

    }


I see an JIRA issue that states Java Spring doesn’t support User Defined Type (UDT) in Maps.


Any thoughts on how to handle this?



DuyHai Doan

unread,
Oct 6, 2017, 10:11:58 AM10/6/17
to DataStax Java Driver for Apache Cassandra User Mailing List
Maybe you should use another mapper that supports UDT

1) the Java driver mapper module
2) Achilles

uttam anand

unread,
Oct 6, 2017, 1:49:23 PM10/6/17
to DataStax Java Driver for Apache Cassandra User Mailing List, DuyHai Doan
Hi Guys,

Did anyone installed Cassandra cluster in docker Swarm mode using docker-compose ?
If yes, can you please share the docker-compose file?

I have installed Cassandra in non cluster mode on Docker Swarm using docker-compose. But whenever, I try to give "mode : global" (If you give mode as global, it will spin up one container per VM in the swarm ), then the cluster is not formed. Instead , separate instances of Cassandra is getting formed.

Can anyone help in this regard?


Thanks
Ryan

--
You received this message because you are subscribed to the Google Groups "DataStax Java Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.
Reply all
Reply to author
Forward
0 new messages