Alex Oscherov
Alex Oscherov

Reputation: 31

Using cassandra mapper with UDT in java

I am total novice with cassandra and have a following problem: I defined a simple UDT import com.datastax.oss.driver.api.mapper.annotations.CqlName;

    @CqlName("emailaddress")

public class EmailAddress {
    private String name;
    private String email_address;

    public EmailAddress() {}
    public EmailAddress(String name, String emailAddress) {
        this.name = name;
        this.email_address = emailAddress;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail_address() {
        return email_address;
    }

    public void setEmail_address(String email_address) {
        this.email_address = email_address;
    }
}

I have following line in definition for my entity:

....

@Frozen
private List<EmailAddress> participants;

.....

I created simple Dao with one method save() but when I trying to run it I am getting following error

The CQL ks.table: signature_data.signatures defined in the entity class: com.salesforceiq.graph.sigparser.Signatures declares type mappings that are not supported by the codec registry: Field: participants, Entity Type: com.salesforceiq.graph.sigparser.EmailAddress, CQL type: UDT(signature_data.emailaddress) java.lang.IllegalArgumentException: The CQL ks.table: signature_data.signatures defined in the entity class: com.salesforceiq.graph.sigparser.Signatures declares type mappings that are not supported by the codec registry: Field: participants, Entity Type: com.salesforceiq.graph.sigparser.EmailAddress, CQL type: UDT(signature_data.emailaddress)

I probably miss some annotation for my UDT but I can't figure out which one

Upvotes: 1

Views: 1278

Answers (1)

Erick Ramirez
Erick Ramirez

Reputation: 16323

I'm assuming you annotated your UDT class with @Entity. See the Entities page of the Cassandra Java driver for an example.

It appears to fail on the participants column. Its type isn't supported so you might need to implement a custom codec for it. See the Custom codecs page for details. Cheers!

Upvotes: 4

Related Questions