spring-projects / spring-projects/spring-data-cassandra

Investigate on using Cassandra CodecRegistry for type mapping [DATACASS-283]

Open
#454 1 comment 0 reactions 1 assignee View on GitHub

@mp911de is already working on this.

Since Dec 31, 2020.

type: task
Dominant language
Java
Stars
400
Forks
318
PR merge metrics
No merged PRs in 30d

Description

Mark Paluch opened DATACASS-283 and commented

The Cassandra 3 Java driver provides a CodecRegistry which allows the usage of custom codecs for object and UDT value mapping. The mapper is an additional artifact which could be added optionally to the classpath.

@UDT(name = "address")
public class Address { ... }

codec = AnnotationParser.parseUDT(mappedClass, ReflectionMapper.factory(), this);
session.getCluster().getConfiguration().getCodecRegistry().register(codec);

Row row = session.execute("select address from user where id = 1").one();
Address address = row.get("address", Address.class);

See also https://github.com/datastax/java-driver/tree/3.0/driver-mapping


Reference URL: https://datastax.github.io/java-driver/manual/object_mapper/custom_codecs/

Issue Links:

  • DATACASS-295 Add an easy way to configure auto json/xml serialization to cassandra text types

  • DATACASS-318 Update CassandraCqlClusterFactoryBean with support for setting CodecRegistry

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.