Reputation: 1209
I have the following object which I need to store in Cassandra. Do I need to use UDT or is there any other way to store the object. I need to finally store this from spring-boot application using Repository approach.
{
"name": "Krishna",
"age" : 24,
"address" : [
{
"attributes" : [
{
"name": "",
"value" : ""
}
],
"contactnumbers" : [ "123123234", "123456"]
}
],
"devices" : [
"android_pixel",
"ios_6s"
]
}
Upvotes: 0
Views: 700
Reputation: 192
I think, you need to use UDT here. I could come up with this.
CREATE TYPE attribute_info (
name text,
value text
);
CREATE TYPE address_info (
attributes list<frozen<attribute_info>>,
contactnumbers list<text>
);
CREATE TYPE user_info (
name text,
age int,
address list<frozen<address_info>>,
devices list<text>
);
Once you get user_info
under your key space
, use it as a type for the column while creating or altering the table.
Upvotes: 3