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;
}
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.
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.
We now support lightweight transactions via InsertOptions and UpdateOptions. Options can be used with the imperative, asynchronous and reactive templates using insert(…) and update(…) write methods. Write methods do not return the entity if the operation is not applied because of a lightweight transaction. Specifically, the resulting entity is null using the imperative and asynchronous Cassandra templates.
The reactive Cassandra template suppresses particular entities (inserted/updated through a entity stream) if its write operation was not applied due to a lightweight transaction.
InsertOptions lwtInsertOptions = InsertOptions.builder().withIfNotExists().build();
User user = new User("heisenberg", "Walter", "White");
User inserted = template.insert(user, lwtInsertOptions);
UpdateOptions lwtUpdateOptions = UpdateOptions.builder().withIfExists().build();
User user = new User("heisenberg", "Walter", "White");
User updated = template.update(user, lwtUpdateOptions);
We now follow a more consistent naming scheme for cassandra repository interfaces.
* The basic, store-specific interface is now named CassandraRepository
* An extended variant, using MapId's is named MapIdCassandraRepository
That results in the following renames:
* CassandraRepository -> MapIdCassandraRepository
* TypedIdCassandraRepository -> CassandraRepository
TypedIdCassandraRepository was re-introduced as deprecated variant now extending CassandraRepository to preserve a majority of existing repository declarations.
We relocated packages of the former Spring CQL module and mapping/convert packages of the Spring Data Cassandra module:
org.springframework.cassandra -> org.springframework.data.cql
org.springframework.cassandra.core.cql.generator -> org.springframework.data.cql.core.generator
org.springframework.cassandra.core.cql -> org.springframework.data.cql.core
org.springframework.data.cassandra.convert -> org.springframework.data.cassandra.core.convert
org.springframework.data.cassandra.mapping -> org.springframework.data.cassandra.core.mapping
Improve documentation on CassandraTemplate. Explain differences between Spring CQL and Spring Data Cassandra. Add User-Defined-Type mapping example. Fix typos.