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

Improve mapping specifications between Cassandra & Java [DATACASS-128] #302

Closed
spring-projects-issues opened this issue May 14, 2014 · 3 comments
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented May 14, 2014

Matthew T. Adams opened DATACASS-128 and commented

CassandraSimpleTypeHolder's static block initializes Cassandra/Java type mappings by iterating over the value returned by Cassandra's DataType.allPrimitiveTypes(). The order in which DataType instances are returned is not guaranteed, and, further, multiple Cassandra types map to a single Java type.

Cassandra types ASCII, VARCHAR & TEXT map to java.lang.String; BIGINT & COUNTER map to java.lang.Long; BLOB & CUSTOM map to java.nio.ByteBuffer; UUID & TIMEUUID map to java.util.UUID.

This means that if, during schema generation, the generator encounters a Java type that maps to multiple C* types (String, Long, ByteBuffer, or UUID), the generator can't know the C* type that should be used; it must be told.

We'll consider adding an attribute ??? dataType() default ??? with an appropriate default to the @Column annotation so that developers can disambiguate the C* type to be used. We can't use DataType.Name for the attribute's type since there's no enum value meaning "no type".

If schema generation is not being used, then this issue is moot, provided that the Java type of the property is mapped appropriately to the target column's type by the DataStax driver


Affects: 1.0 M1 (Dijkstra), 1.0 RC1 (Dijkstra)

Issue Links:

Referenced from: commits 183c502

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 14, 2014

Matthew T. Adams commented

This issue arose from reviews of #7 & #8, which are now closed and refer to this issue

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Jul 5, 2016

Mark Paluch commented

String and Long/long types were tied to a specific type. String property map to text column type and long properties map to bigint. These changes were part of DATACASS-280 and DATACASS-271.

Users can specify the column type with @CassandraType(type = …) to override defaults.

We should inspect ByteBuffer and UUID (currently maps to timeuuid by default) types whether they should map to different Cassandra types by default

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Aug 30, 2017

Mark Paluch commented

Type mapping fixed via DATACASS-271, DATACASS-280, DATACASS-375

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

No branches or pull requests

2 participants