Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
spring-projects-issues opened this issue Apr 29, 2016 · 1 comment
Assignees
Labels
type: task A general task

Comments

@spring-projects-issues
Copy link

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

@mp911de
Copy link
Member

mp911de commented Jan 29, 2021

Calling codecFor(…) responds with an exception if the type isn't found. So a plain approach to ask the codec registry whether a particular codec can be resolved/handled by the driver would impose a lot of CPU drag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants