Use HANA-specific types: LargeString (NCLOB), LargeBinary (BLOB), hana.ST_POINT, and hana.tableType.
LargeString and LargeBinary — when to use themcds.hana.POINT, cds.hana.ST_GEOMETRY@hana.fullTextIndex, @hana.collationHANA Cloud offers column types and indexing strategies unavailable in SQLite. Knowing which annotations unlock them saves you from hand-crafting native SQL for features CAP can generate automatically.
| CDS type | HANA type | SQLite type |
|---|---|---|
String(n) |
NVARCHAR(n) |
TEXT |
Integer |
INTEGER |
INTEGER |
Decimal(p, s) |
DECIMAL(p, s) |
REAL |
Boolean |
BOOLEAN |
INTEGER |
Date |
DATE |
TEXT |
DateTime |
SECONDDATE |
TEXT |
Timestamp |
TIMESTAMP |
TEXT |
UUID |
NVARCHAR(36) |
TEXT |
Binary(n) |
VARBINARY(n) |
BLOB |
entity Documents {
key ID : UUID;
title : String;
body : LargeString; // → NCLOB in HANA (up to 2GB text)
attachment : LargeBinary; // → BLOB in HANA (up to 2GB binary)
thumbnail : Binary(32768); // small fixed-size binary
}
Use
LargeStringfor rich text, JSON, or Markdown content. UseLargeBinaryfor file attachments. Never selectLargeString/LargeBinarycolumns in list queries — fetch them only for individual records.
// Opt in to HANA-native types with cds.hana namespace
using { cds.hana } from '@sap/cds/common';
entity Locations {
key ID : UUID;
name : String;
coordinates : hana.ST_POINT; // spatial point (lat/lon)
boundary : hana.ST_GEOMETRY; // polygon / multipolygon
}
-- OData exposes these as opaque strings; use native SQL for spatial queries
SELECT ID, name,
coordinates.ST_AsGeoJSON() AS geoJson,
coordinates.ST_Distance(ST_GeomFromText('POINT(13.4 52.5)','WGS84')) AS distanceM
FROM Locations
ORDER BY distanceM;
entity Books {
key ID : UUID;
title : String @hana.fullTextIndex; // basic full-text
description : String @hana.fullTextIndex: {
fuzzySearchIndex: true, // fuzzy matching
text_analysis: true // language detection
};
}
Enables HANA's CONTAINS() predicate in OData $filter:
GET /Books?$filter=contains(description,'machine learning')&fuzzy=0.8
entity FactSales @hana.tableType: 'COLUMN' { // default for HANA
// good for analytical queries
}
entity SessionLog @hana.tableType: 'ROW' { // transactional
// good for high-frequency inserts/updates
}
entity Products {
code : String @hana.collation: 'BINARY'; // exact case match
name : String; // UNICODE by default (case-insensitive)
}
| Annotation | Effect |
|---|---|
@hana.fullTextIndex |
Creates full-text index on the column |
@hana.tableType: 'COLUMN' |
Column store (default); analytical workloads |
@hana.tableType: 'ROW' |
Row store; transactional workloads |
@hana.collation: 'BINARY' |
Case-sensitive string comparison |
@hana.storeType: 'PAGE' |
Page-based blob storage |
| Your intent | Use on SQLite | Use on HANA |
|---|---|---|
| Long text (markdown, JSON) | LargeString |
LargeString → NCLOB |
| File content | LargeBinary |
LargeBinary → BLOB |
| UUID primary key | UUID |
UUID → NVARCHAR(36) |
| Geographic point | Not available | hana.ST_POINT |
description: LargeString to your Books entitytitle with @hana.fullTextIndex: { fuzzySearchIndex: true }location: hana.ST_POINT field to a Stores entitycds build --for hana and inspect the generated artifact to confirm NCLOB vs NVARCHARLargeString → NCLOB in HANA; avoid in list queries — fetch for single records only@hana.fullTextIndex enables contains() OData filterhana.ST_POINT / hana.ST_GEOMETRY for spatial types — HANA only