Annotation Interface SpaceId
To designate a property as the entity's primary key. The getter method of the POJO object provides a matchable fields for the space. Define whether this field value to be used as when generating UID. The field value should be unique, i.e. no multiple objects with the same value should be written into the space, each object should have a different field value. When writing an object into the space with existing PrimaryKey field value EntryAlreadyInSpaceException will be thrown. UID is created based on the PrimaryKey field value.
To designate multiple properties as a composite primary key, use this annotation on the class and
use properties() to list the participating properties. Naturally properties()
and autoGenerate() cannot be used together, as composite key cannot be autogenerated.
- Since:
- 5.1
- Author:
- Lior Ben Yizhak
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanThe auto-generate property defines how a unique ID is generated.Indicated if the space id should be indexed, and if so with which index type.String[]When used at the class level, denotes the properties which participate in a composite space id.
-
Element Details
-
autoGenerate
boolean autoGenerateThe auto-generate property defines how a unique ID is generated. By default, the auto-generate isfalse, indicating that a unique ID will be generated from the annotated field's supplied value'stoString(). This field can be of any type, but it's value's string representation enforces uniqueness.When auto-generate is
true, it indicates that a unique ID will be generated by the space (when first written) injecting the UIDStringvalue into this field - which must be of typeString.- Default:
- false
-
properties
String[] propertiesWhen used at the class level, denotes the properties which participate in a composite space id.- Since:
- 16.2
- Default:
- {}
-
indexType
SpaceIndexType indexTypeIndicated if the space id should be indexed, and if so with which index type. By default, whenautoGenerate()is true the property is not indexed, otherwise it's indexed with either a regularSpaceIndexType.EQUALindex or a compound index, depending if the id is a single or multiple properties.- Since:
- 16.2
- Default:
- DEFAULT
-