Consider @Column and @Element annotated constructor parameters.

We now allow using Column and Element annotations for constructor arguments when using constructor creation from columns/UDT fields respective tuple value elements. The column name/element ordinal can be overwritten for persistent properties. Non-persistent properties can be easier obtained than through the Value("…") annotation that uses SpEL.

Closes #1104.
This commit is contained in:
Mark Paluch
2021-03-30 14:14:32 +02:00
parent 024214fbac
commit f75d692221
8 changed files with 725 additions and 72 deletions

View File

@@ -7,6 +7,7 @@ This chapter summarizes changes and new features for each release.
== What's new in Spring Data for Apache Cassandra 3.2
* <<cassandra.template.prepared-statements,Support for prepared statements>> using `CassandraTemplate` and repositories (enabled by default).
* `@Column` and `@Element` can be used on constructor arguments.
[[new-features.3-1-0]]
== What's new in Spring Data for Apache Cassandra 3.1

View File

@@ -432,6 +432,7 @@ In order to reference a property of a given `Row`/`UdtValue`/`TupleValue` one ha
Entity-bound insert and update statements do not include this property.
* `@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.
Can be used on constructor arguments to customize the column name during constructor creation.
* `@Embedded`: Applied at the field level.
Enables embedded object usage for types mapped to a table or a user-defined type.
Properties of the embedded object are flattened into the structure of its parent.
@@ -448,6 +449,7 @@ Types are derived from the declaration by default.
* `@Tuple`: Applied at the type level to use a type as a mapped tuple.
* `@Element`: Applied at the field level to specify element or field ordinals within a mapped tuple.
Types are derived from the property declaration by default.
Can be used on constructor arguments to customize tuple element ordinals during constructor creation.
* `@Version`: Applied at field level is used for optimistic locking and checked for modification on save operations.
The initial value is `zero` which is bumped automatically on every update.