Show TOC

Entities (CDS)Locate this document in the navigation structure

A CDS entity is a table with a set of data elements that are organized using columns and rows.

Context

Procedure

  1. Select the Entity tool in the CDS toolbox and click in the diagram.

    You can create entities at the model root, under a HANA package, or under a context.

  2. Open the property sheet, and complete properties as appropriate:

    Property

    Description

    Name/Code/Comment

    Identify the object. The name should clearly convey the object's purpose to non-technical users, while the code, which is used for generating code or scripts, may be abbreviated, and should not normally include spaces. You can optionally add a comment to provide more detailed information about the object. By default the code is generated from the name by applying the naming conventions specified in the model options. To decouple name-code synchronization, click to release the = button to the right of the Code field.

    Schema

    [CDS Repository: entities created at root or in a HANA package] Specifies the schema to which the entity belongs.

    Type

    Specifies the type of the generated table. You can choose between:
    • Row - [default] If the majority of table access involves selecting a few records, with all attributes selected, ROW-based storage is preferable.
    • Column - If the majority of table access will be through a large number of tuples, with only a few selected attributes, COLUMN-based storage should be used.
    • Global temporary - The table definition is globally available while data is visible only to the current session. The table is truncated at the end of the session.

    Unload priority

    [HDI] Specifies the unload priority for the generated table from 0 to 9, where 0 means the table cannot be unloaded and 9 means earliest unload.

    Scripting name: UnloadPriority

    Group options

    [HDI] Specifies the group options for the generated table.

    Scripting name: GroupOptionClause

  3. Click the Columns tab to specify the entity attributes.
    For each attribute, enter an appropriate Name and then select a type from the Data type field list (or click the ... tool to the right of the list to select a simple or structured type).
    Note Anonymous types and enumerations are not supported.
    To specify an attribute as a key, select the checkbox in its P column.

    The following extensions are available on the Detail tab of column property sheets:

    Name

    Description

    Column stored data type

    Specifies the stored data type.

    Scripting name: StoreDataType

    DDIC data type

    Specifies the application data type.

    Scripting name: DDICDataType

  4. Click the entity Indexes tab to specify any indexes.

    The following extensions are available on the General tab of index property sheets:

    Name

    Description

    Type

    Specifies the type of the index, which can be:
    • <none> - [default] The server will choose the appropriate index type.
    • Cpbtree - Compressed Prefix B+-Tree, which can show better performance for larger keys for character, string, binary string, or decimal column types, or when the constraint is a composite key, or a non-unique constraint.
    • Btree - Maintains sorted data that performs efficient insertion, deletion and search of records.
    • Fulltext - Creates an additional data structure to enable text search features on a specific column in a table. Enables the Full-Text tab (see below).

    Scripting name: DescIndex

    Descending

    [btree only] Specifies that the index should be created in descending order.

    Scripting name: DescIndex

  5. [HDI] Click the entity Partitions tab and specify the partition scheme:

    Name

    Description

    Type
    Specifies the partition scheme type:
    • Hash - Distributes rows to partitions equally for load balancing and to overcome the 2 billion row limitation. Specify an Expression listing the columns to partition on and the Quantity of partitions to create. You may specify a second scheme of type Hash or Range.
    • Range - Creates partitions for specific values or value ranges. Specify an Expression and Range specifier.
    • RoundRobin - Distributes rows to partitions equally without specifying partitioning columns. Specify the Quantity of partitions to create. You may specify a second scheme of type Range.

    Scripting name: FirstPartitionElement, Hash1Expression, Hash1Quantity, Range1Expression, Range1Spec, Round1Quantity, SecondPartitionElement, Hash2Expression, Hash2Quantity, Range2Expression, Range2Spec

  6. Click OK to complete the creation of the entity.
    To preview the code to be generated:
    • For entities created at the model root or in a HANA package, use the entity's Preview tab.
    • For entities created in a context, use the context's Preview tab.