Show TOC

Background documentationRunning JPA Applications on the System Data Source Locate this document in the navigation structure

 

You can use the System DataSource that comes with the AS Java to connect your JPA-based applications to the underlying system database. By using the System DataSource, your applications are able to access the underlying database using the Open SQL framework.

More information: Overview of the Java Persistence Infrastructure

Note Note

If you want to connect your application to existing tables in an external database, then you should consider using a custom DataSource with Native SQL or Vendor SQL access type. Open SQL is not an option in this case, since it only works using the System DataSource and connecting to the system database schema.

More information about defining custom DataSources: Working with Data Sources

End of the note.

Running JPA against the System DataSource has two consequences:

  • The System DataSource is configured for the lowest available isolation level, typically read_uncommitted, and you have to prepare the version control of the JPA implementation by SAP for dirty read effects.

    More information: Versioning and Dirty Reads

  • The System DataSource is accessed through the Open SQL layer, using the Open SQL grammar. Due to this, the SAP implementation of JPA experiences certain restrictions in the Java Persistence Query Language (JPQL) when your application runs on the System DataSource:

    • The CONCAT, SUBSTRING, TRIM, LOWER, UPPER, LENGTH, LOCATE built-in functions are not supported.

    • The CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP date/time functions are not supported.

    • The ABS, SQRT, MOD arithmetic functions are not supported.

    • Input parameters within arithmetic expressions are not supported (for example, WHERE e.count = ?1 + ?2).

    • Input parameters within a NULL expression (for example, WHERE ?1 is NULL) are not supported.

    • The aggregate function COUNT can only be used in conjunction with DISTINCT.

    • The result of a subquery, if used with IN, ANY, SOME, ALL, may consist only of a single persistent-field.

    • Right-deep outer joins are not admissible. In particular, outer joins over relationships that involve join tables are mapped to right-deep outer joins.

    More information: Open SQL Grammar

    This list is not exhaustive.

There are also value restrictions imposed by the Open SQL type systems.

More information: Open SQL Data Types