Add tests that verify Java class to Cassandra type mapping for simple types that are supported natively by the driver.
Related tickets: DATACASS-271, DATACASS-280, DATACASS-375.
We map varchar and text types explicitly to data types to ensure resolution to the appropriate data type if queried by name. The driver returns only text via DataType.allPrimitiveTypes() because text and varchar are aliases and allPrimitiveTypes returns a set.
Remove indirection via MultiLevelSetFlattenerFactoryBean and create a KeyspaceActions wrapper that encapsulates the actual actions. Introduce KeyspaceActionSpecificationFactory for keyspace action creation.
Encapsulate required KeyspaceSpecification properties in immutable base classes. Introduce static factory methods to create value objects where possible. Rewrite Javadoc to reflect the nature of configuration objects and not builders since these objects to not build a target object. Refactor duplicate code into utility classes.
Mark all packages with Spring Frameworks @NonNullApi. Add Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fix Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances.
Encapsulate KeyspaceIdentifier and CqlIdentifier with static factory methods to avoid temporary null state of fields.
Require non-null QueryOptions and provide empty option instances. Introduce methods returning non-null values (getRequired…()) for code paths known to operate on values that are available.
We now return the domain type via CassandraQueryMethod.getEntityInformation() for query derivation. Previously, interface types were returned and they were used as input type for query derivation. Query methods referencing domain type properties that do not exist on the projection type caused PropertyReferenceException.
We now create SASI (SSTable Attached Secondary Index) indexes during session initialization for properties annotated with @SASI. Properties can be annotated with analyzer-annotations to configure analyzers.
@Table
public class Person {
@Id String id;
@SASI String names;
@SASI @StandardAnalyzed(value = "de",
enableStemming = true, normalization = Normalization.UPPERCASE,
skipStopWords = true) String profession;
@SASI @NonTokenizingAnalyzed String country;
}
We now create secondary indexes for annotated properties via @Indexed. Index creation is part of schema creation that is executed after Session initialization and table creation.
We support plain secondary indexes and key/value/entry indexes for map columns. Index creation is useful for rapid development but should not be used in large setups or at least with care to not impact performance in a negative way.
@Table
public class Person {
@Id
private String key;
@Indexed("name_index")
private String name;
private Map<@Indexed String, String> keys;
}
We no longer expose selectBySimpleIds(…) via CassandraOperations. selectBySimpleIds was a limited short-cut method that create a SELECT statement using the primary key name and using Id values as-is without applying type conversions. The replacement is to use a select(…) method accepting Query and an appropriate query:
select(query(where("id")).in("key", "other-key"), Person.class)
assuming the primary key property is id.
Increase CassandraRepositoryConfigurationExtension visibility as this class is required by configuration infrastructure that configures Cassandra repository support such as Spring Boot.
Initialize MappingCassandraConverter with generic custom conversions and resolve package cycle between mapping and convert by initializing MappingCassandraConverter with generic custom conversions. Cassandra-specific custom conversions require external wiring via configuration.
Move IdInterfaceValidator to mapping package to resolve the final cycle between mapping and repository.support.
Introduced CassandraRepositoryNamespaceHandler to extend the core one and register the parser for the repositories element. Consolidated schemas into cassandra.config package. Reduced configuration class visibility where possible.
Resolve o.s.d.cql package to expose only a single top-level package. Components of the dissolved org.springframework.data.cql package are located in other packages:
* o.s.d.cql.config and subpackages -> o.s.d.cassandra.config
* o.s.d.cql.core.session -> o.s.d.cassandra and o.s.d.cassandra.core.cql.session
* o.s.d.cql.cql.support.exception -> o.s.d.cassandra and o.s.d.cassandra.cql
* o.s.d.cql -> o.s.d.cassandra.core.cql
* Move MapId from o.s.d.cassandra.repository.support to o.s.d.cassandra.mapping
Merge test.integration package with repository test package.
We now return WriteResult for insert(…) and update(…) methods accepting WriteOptions. Conditional writes return a state whether the operation was applied or not and this result is propagated via WriteResult to the caller.
Synchronous insert(…) and update(…) without WriteOptions methods do not return a value and are consistent with other Template API modules. The absence of an Exception indicates success. Asynchronous and reactive insert(…) and update(…) without WriteOptions continue to return the entity to make the entity accessible after operation completion.
Previously, we returned null if a lightweight transaction was not applied or suppressed the value value emission.
Removing insert(…), update(…) and delete(…) methods accepting Publisher because these methods hide that Cassandra does not support multi-row writes. We don't want to set expectations to support a streaming feature that isn't natively supported.
We now support allow filtering using derived query methods by annotating query methods with AllowFiltering.
interface PersonRepository extends Repository<Person, String> {
@AllowFiltering
List<Person> findAllByFirstname(String firstname);
}
We now map Java's UUID by default to uuid instead of previously timeuuid. The uuid type is a better default after all and comes without the time type restriction.