Skip to content

Cassandra UDT not being persisted in cassandra database #4354

Description

@nishankpathak

Hi @hilagut @fabien @Schoonology , Loopack team,
The code is converting Json object string. We debugged and found the issue with Cassandra.prototype.create function in loopback-connector-cassandra/lib/cassandra.js. Please provide the solution for the issue.

model class
import {Entity, model, property} from '@loopback/repository';
@model()
export class Address {
@Property({
type: 'string'
})
street: string;

@Property({
type: 'string'
})
city: string;

@Property({
type: 'string'
})
state_or_province: string;

@Property({
type: 'string'
})
postal_code: string;

@Property({
type: 'string'
})
country: string;
}
@model({name: 'hotels'})
export class Hotels extends Entity {
@Property({
type: 'string',
id: true,
})
id?: string;

@Property({
type: 'string',
required: true,
})
name: string;

@Property({
type: 'string',
required: true,
})
phone: string;

@Property({
type: 'Object',
required: true
})
address: Address;

@Property({
type: 'array',
itemType: 'string'
})
pois: string[];

// Define well-known properties here

// Indexer property to allow additional data
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[prop: string]: any;

constructor(data?: Partial) {
super(data);
}
}

export interface HotelsRelations {
// describe navigational properties here
}

export type HotelsWithRelations = Hotels & HotelsRelations;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions