DATACASS-623 - Add support for read-only properties.

We now support read-only properties by annotating such properties with @ReadOnlyProperty. Read-only properties are read from results but never written (i.e. through INSERT or UPDATE) back to Cassandra.

Read-only properties can still be updated by using the Update/Query API.

class Person {

  @Id String id;

  String firstname;
  String lastname;
  @ReadOnlyProperty String externallyUpdatedProperty;
}

CassandraTemplate template = …
Person person = …
template.insert(person);
This commit is contained in:
Mark Paluch
2019-01-31 10:01:01 +01:00
parent 9e825d376e
commit 3a062afafb
5 changed files with 67 additions and 15 deletions

View File

@@ -3,6 +3,10 @@
This chapter summarizes changes and new features for each release.
[[new-features.2-2-0]]
== What's new in Spring Data for Apache Cassandra 2.2
* Read-only properties annotated with `@ReadOnlyProperty` to exclude non-writable properties from entity-bound `INSERT` and `UPDATE` operations.
[[new-features.2-1-0]]
== What's new in Spring Data for Apache Cassandra 2.1
* New annotations for `@CountQuery` and `@ExistsQuery`.

View File

@@ -414,6 +414,7 @@ to indicate either a single or a composite (compound) primary key. If used on a
* `@PrimaryKeyClass`: Applied at the class level to indicate that this class is a compound primary key class.
Must be referenced with `@PrimaryKey` in the entity class.
* `@Transient`: By default, all private fields are mapped to the row. This annotation excludes the field
* `@ReadOnlyProperty`: Applies at the field level to mark a property as read-only. Entity-bound insert and update statements do not include this property.
where it is applied from being stored in the database.
* `@Column`: Applied at the field level. Describes the column name as it is represented in the Cassandra table,
thus letting the name differ from the field name of the class.