Package com.oracle.nosql.spring.data.core.mapping

# Annotation Interface NosqlTable

@Inherited @Retention(RUNTIME) @Target(TYPE) public @interface NosqlTable
Optional annotation used to set options regarding the table used for entity.

If annotation is not explicitly used the `TableLimits` are determined by `NosqlDbConfig.getDefaultCapacityMode()`, `NosqlDbConfig.getDefaultStorageGB()`, `NosqlDbConfig.getDefaultReadUnits()`, and `NosqlDbConfig.getDefaultWriteUnits()`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `NosqlTable.TtlUnit`

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `boolean`
  `autoCreateTable`
  Flag that indicates if automatic creation of table is enabled.
  `NosqlCapacityMode`
  `capacityMode`
  Sets the capacity mode when table is created.
  `String`
  `consistency`
  Sets the default consistency for all read operations applied to this table.
  `String`
  `durability`
  Sets the default durability for all write operations applied to this table.
  `int`
  `readUnits`
  Sets the read units when table is created.
  `int`
  `storageGB`
  Sets the storageGB when table is created.
  `String`
  `tableName`
  Sets the name of the table to be used for this entity.
  `int`
  `timeout`
  Sets the default timeout in milliseconds for all operations applied on this table.
  `int`
  `ttl`
  Sets the default table level Time to Live (TTL) when table is created.
  `NosqlTable.TtlUnit`
  `ttlUnit`
  Sets the unit of TTL value.
  `int`
  `writeUnits`
  Sets the write units when table is created.

- ## Element Details

  - ### tableName

    String tableName
    Sets the name of the table to be used for this entity. If not set or set to "", the `Class.getSimpleName()` is used.
    Default:
      `""`

  - ### autoCreateTable

    boolean autoCreateTable
    Flag that indicates if automatic creation of table is enabled. By default this is set to `Constants.DEFAULT_AUTO_CREATE_TABLE`.
    Default:
      `true`

  - ### capacityMode

    NosqlCapacityMode capacityMode
    Sets the capacity mode when table is created. This applies only in cloud or cloud sim scenarios.

    For `TableLimits` to be set one of the following two conditions must be met:

    - capacityMode is set to PROVISIONED and all three: readUnits, writeUnits and storageGB must be greater than 0,
    - or capacityMode is set to ON_DEMAND and storageGB must be greater than 0.

    If not set the default value is `NosqlCapacityMode.PROVISIONED`.

    Since:
      1.3.0
    Default:
      `PROVISIONED`

  - ### readUnits

    int readUnits
    Sets the read units when table is created. Valid values are only values greater than 0. This property applies only in cloud or cloud sim scenarios and capacity mode is `NosqlCapacityMode.PROVISIONED`. If not set the value `NosqlDbConfig.getDefaultReadUnits()` is used. All three: readUnits, writeUnits and storageGB must be greater than 0 to set a valid `TableLimits`.
    Default:
      `-1`

  - ### writeUnits

    int writeUnits
    Sets the write units when table is created. Valid values are only values greater than 0. This applies only in cloud or cloud sim scenarios and capacity mode is `NosqlCapacityMode.PROVISIONED`. If not set the value `NosqlDbConfig.getDefaultWriteUnits()` is used. All three: readUnits, writeUnits and storageGB must be greater than 0 to set a valid `TableLimits`.
    Default:
      `-1`

  - ### storageGB

    int storageGB
    Sets the storageGB when table is created. This applies only in cloud or cloud sim scenarios.

    If not set, the value of `NosqlDbConfig.getDefaultStorageGB()` is used.

    A 0 or less than -1 value will force no table limits, but they are required in cloud and cloudsim instalations.

    For `TableLimits` to be set one of the following two conditions must be met:

    - capacityMode is set to PROVISIONED and all three: readUnits, writeUnits and storageGB must be greater than 0,
    - or capacityMode is set to ON_DEMAND and storageGB must be greater than 0.
    Default:
      `-1`

  - ### consistency

    String consistency
    Sets the default consistency for all read operations applied to this table. Valid values for this are defined in `Consistency`. If not set the default value for this is EVENTUAL.
    Default:
      `"EVENTUAL"`

  - ### durability

    String durability
    Sets the default durability for all write operations applied to this table. Valid values for this are defined in `Durability`. If not set the default value for this is COMMIT_NO_SYNC.

    Note: This applies to On-Prem installations only.

    Default:
      `"COMMIT_NO_SYNC"`

  - ### timeout

    int timeout
    Sets the default timeout in milliseconds for all operations applied on this table. If not set the default value is 0 which means it is ignored. Note: `NosqlRepository.setTimeout(int)` take precedence over the set here.
    Default:
      `0`

  - ### ttl

    int ttl
    Sets the default table level Time to Live (TTL) when table is created. TTL allows automatic expiration of table rows when specified duration of time is elapsed. If not set the value `Constants.NOTSET_TABLE_TTL` is used, which means no table level TTL. This is applicable only when `autoCreateTable()` is set to true.
    Since:
      1.5.0
    See Also:
      - `TimeToLive`
      - Using TTL
    Default:
      `0`

  - ### ttlUnit

    NosqlTable.TtlUnit ttlUnit
    Sets the unit of TTL value. If not set the default value is days. This is applicable only when `autoCreateTable()` is set to true.
    Since:
      1.5.0
    See Also:
      - `TimeToLive`
      - Using TTL
    Default:
      `DAYS`