Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 35 additions & 33 deletions java/cds-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,44 @@ uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/

The [predefined CDS types](../cds/types) are mapped to Java types and as follows:

| CDS Type | Java Type | Remark |
|--------------------|------------------------|--------------------------------------------------------------------------|
| `cds.UUID` | `java.lang.String` | |
| `cds.Boolean` | `java.lang.Boolean` | |
| `cds.UInt8` | `java.lang.Short` | |
| `cds.Int16` | `java.lang.Short` | |
| `cds.Int32` | `java.lang.Integer` | |
| `cds.Integer` | `java.lang.Integer` | |
| `cds.Int64` | `java.lang.Long` | |
| `cds.Integer64` | `java.lang.Long` | |
| `cds.Decimal` | `java.math.BigDecimal` | |
| `cds.DecimalFloat` | `java.math.BigDecimal` | deprecated |
| `cds.Double` | `java.lang.Double` | |
| `cds.Date` | `java.time.LocalDate` | date without a time-zone (year-month-day) |
| `cds.Time` | `java.time.LocalTime` | time without a time-zone (hour-minute-second) |
| `cds.DateTime` | `java.time.Instant` | instant on the time-line with _sec_ precision |
| `cds.Timestamp` | `java.time.Instant` | instant on the time-line with _µs_ precision |
| `cds.String` | `java.lang.String` | |
| `cds.LargeString` | `java.lang.String` | `java.io.Reader` <sup>(1)</sup> if annotated with `@Core.MediaType` |
| `cds.Binary` | `byte[]` | |
| `cds.LargeBinary` | `byte[]` | `java.io.InputStream` <sup>(1)</sup> if annotated with `@Core.MediaType` |
| `cds.Vector` | `com.sap.cds.CdsVector`| for [vector embeddings](#vector-embeddings) |
| CDS Type | Java Type | Remark |
| ------------------ | ----------------------- | ------------------------------------------------------------------------ |
| `cds.UUID` | `java.lang.String` | |
| `cds.Boolean` | `java.lang.Boolean` | |
| `cds.UInt8` | `java.lang.Short` | |
| `cds.Int16` | `java.lang.Short` | |
| `cds.Int32` | `java.lang.Integer` | |
| `cds.Integer` | `java.lang.Integer` | |
| `cds.Int64` | `java.lang.Long` | |
| `cds.Integer64` | `java.lang.Long` | |
| `cds.Decimal` | `java.math.BigDecimal` | |
| `cds.DecimalFloat` | `java.math.BigDecimal` | deprecated |
| `cds.Double` | `java.lang.Double` | |
| `cds.Date` | `java.time.LocalDate` | date without a time-zone (year-month-day) |
| `cds.Time` | `java.time.LocalTime` | time without a time-zone (hour-minute-second) |
| `cds.DateTime` | `java.time.Instant` | instant on the time-line with _sec_ precision |
| `cds.Timestamp` | `java.time.Instant` | instant on the time-line with _µs_ precision |
| `cds.String` | `java.lang.String` | |
| `cds.LargeString` | `java.lang.String` | `java.io.Reader` <sup>(1)</sup> if annotated with `@Core.MediaType` |
| `cds.Binary` | `byte[]` | |
| `cds.LargeBinary` | `byte[]` | `java.io.InputStream` <sup>(1)</sup> if annotated with `@Core.MediaType` |
| `cds.Vector` | `com.sap.cds.CdsVector` | for [vector embeddings](#vector-embeddings) |

### SAP HANA-Specific Data Types

To facilitate using legacy CDS models, the following [SAP HANA-specific data types](../advanced/hana#hana-types) are supported:

| CDS Type | Java Type | Remark |
| --- | --- | --- |
| `hana.TINYINT` | `java.lang.Short` | |
| `hana.SMALLINT` | `java.lang.Short` | |
| `hana.SMALLDECIMAL` | `java.math.BigDecimal` | |
| `hana.REAL` | `java.lang.Float` | |
| `hana.CHAR` | `java.lang.String` | |
| `hana.NCHAR` | `java.lang.String` | |
| `hana.VARCHAR` | `java.lang.String` | |
| `hana.CLOB` | `java.lang.String` | `java.io.Reader` <sup>(1)</sup> if annotated with `@Core.MediaType` |
| `hana.BINARY` | `byte[]` | |
| CDS Type | Java Type | Remark |
| ------------------- | ---------------------- | ------------------------------------------------------------------- |
| `hana.TINYINT` | `java.lang.Short` | |
| `hana.SMALLINT` | `java.lang.Short` | |
| `hana.SMALLDECIMAL` | `java.math.BigDecimal` | |
| `hana.REAL` | `java.lang.Float` | |
| `hana.CHAR` | `java.lang.String` | |
| `hana.NCHAR` | `java.lang.String` | |
| `hana.VARCHAR` | `java.lang.String` | |
| `hana.CLOB` | `java.lang.String` | `java.io.Reader` <sup>(1)</sup> if annotated with `@Core.MediaType` |
| `hana.BINARY` | `byte[]` | |


> <sup>(1)</sup> Although the API to handle large objects is the same for every database, the streaming feature, however, is supported (and tested) in **SAP HANA**, **PostgreSQL**, and **H2**. See section [Database Support in Java](./cqn-services/persistence-services#database-support) for more details on database support and limitations.
Expand Down Expand Up @@ -275,6 +275,8 @@ person.toJson(); // { "salutation" : "Mr.", name : { "first" : "Frank" } }
Avoid cyclic relationships between CdsData objects when using toJson.
:::

<div id="cdsdata-serialization-jsonconverter"/>


## Vector Embeddings <Beta /> { #vector-embeddings }

Expand Down