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.
We now apply value conversion before instantiating primary key classes to create instances with the appropriate constructor values. This change allows to declare immutable primary key value objects instead of being forced to use mutable objects.
Previously, arguments were passed-thru without conversion causing IllegalArgumentException.
We now insert the entire object including null values again in Cassandra using the repository save method. Objects that are saved through the repository are expected to be returned the same when retrieved again.
Cassandra entities don't have any indicator whether these entities are new to optimize null value handling and prevent tombstones in Cassandra. CassandraRepository exposes insert(…) to insert objects without inserting null values.
Previously, we attempted to execute insert/update conditionally on the entity structure which ended up issuing update statements containing all null values. Entities were not created and save(…) failed silently.
We now no longer insert null values via CassandraOperations.insert(…). Inserting null values creates tombstones in Cassandra which are likely unwanted and impact performance. Omitting null values simply does not create values in Cassandra. Setting properties to null with UPDATE remains unchanged and updating an object containing null values will propagate all null values to Cassandra as part of the UPDATE clause.
SimpleCassandraRepository.save(…) needs to consider whether the entity is new or whether it consists only of primary key properties to propagate the optimization. New entities and entities consisting only of primary key columns are saved via INSERT. All other entities are saved via UPDATE.
Related ticket: DATACASS-428.