Annotation Interface Column
Annotation for a
SpannerPersistentProperty
that allows specifying the column name instead
of deriving it from the field's name.- Since:
- 1.1
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe custom name of the column in the Spanner table, which can differ from the name of the field which it annotates.boolean
If the column's schema should be NOT NULL when generating a schema based on an entity class.boolean
This setting takes effect when the entity in which it appears is used to generate schema DDL.com.google.spanner.v1.TypeCode
Optionally directly specify the column type in Cloud Spanner.long
The maximum length of the column in Cloud Spanner terms.
-
Element Details
-
name
String nameThe custom name of the column in the Spanner table, which can differ from the name of the field which it annotates.- Returns:
- the name of the column in the Spanner table
- Default:
- ""
-
spannerTypeMaxLength
long spannerTypeMaxLengthThe maximum length of the column in Cloud Spanner terms. For example, for STRING columns this refers to the number of characters. For BYTES columns this refers to the number of bytes. This setting is only used when generating schema from an entity class. A setting of less than 0 indicates an unlimited maximum length.- Returns:
- the maximum length for the column
- Default:
- -1L
-
nullable
boolean nullableIf the column's schema should be NOT NULL when generating a schema based on an entity class.- Returns:
false
if the column should be NOT NULL in generated DDL.true
otherwise.
- Default:
- true
-
spannerType
com.google.spanner.v1.TypeCode spannerTypeOptionally directly specify the column type in Cloud Spanner. For ARRAY columns this refers to type of the item the array holds. If this is not specified then it is inferred from the Java property type.- Returns:
- The user-specified column item type.
- Default:
- TYPE_CODE_UNSPECIFIED
-
spannerCommitTimestamp
boolean spannerCommitTimestampThis setting takes effect when the entity in which it appears is used to generate schema DDL. Iftrue
, then the column corresponding to the annotated property will be auto-populated with the latest Cloud Spanner TrueTime commit timestamp of the row.false
for all other usage and columns.- Returns:
true
for auto-populating commit timestamp.false
otherwise.
- Default:
- false
-