Skip to content

Internal CdsJsonConverter documentation #1883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
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