Entering content frame

Component documentation Java Persistence Locate the document in its SAP Library structure

Purpose

The SAP J2EE Engine provides Java applications with a uniform infrastructure for accessing relational databases. Applications have different requirements regarding the way in which they access a relational database. The SAP J2EE Engine provides solutions that are tailored to these requirements. These solutions consist of various interfaces for defining, displaying, and manipulating persistent data.

Basics

The basics for the integrated interaction of the persistence offerings are:

·        Open SQL for Java, which is the underlying layer for all persistence services at the transition point to the relational database

·        The Java Data Dictionary, which is where cross-database objects such as tables are defined

·        Logical locks, which you use to isolate applications from each other without having to use database locks

Services

Java persistence provides applications with the following services and added value:

·        Portability

Without having to go into the specifics of each database, applications can automatically be run on all supported databases.

·        Support of Java standards

The SAP J2EE Engine provides the application with implementations of the Java standards for relational database accesses and for transparent object persistence.

·        Efficiency and scalability

Open SQL for Java contains a configurable table buffer and JDBC statement pooling. Both are directly available to the applications.

·        Maintainability

Database accesses are validated as early as possible before they are executed in the database. During operation, the SAP J2EE Engine provides many options for viewing and examining database accesses of an application in detail (SQL trace, for example).

Database Accesses

If applications access data in a relational database directly, SQLJ or JDBC is used. For SQLJ, SQL statements are statically embedded in Java programs, validated at the time of translation, and converted into an executable format. Unlike SQLJ, JDBC is a programming interface that is used at runtime to dynamically compile SQL statements from application code and send them to the database. Apart from Open SQL, you can also use Native SQL for Java or Vendor SQL to directly use the proprietary abilities of databases (but you lose the Open SQL added values such as portability and table buffering).

Object persistence as opposed to relational persistence provides an object-oriented view of persistent data. Application developers do not work with tables and do not manually write SQL statements explicitly by using SQLJ or JDBC. Instead, the application works directly with Java objects that are automatically made persistent. An application developer no longer writes SQL to load the persistent state from the database into the object or to write from the object to the database.

The SAP J2EE Engine contains an implementation of EJB 2.0 Entity Beans that is J2EE-compliant. EJB is a component model for distributed, server-side applications, and produces various services in the J2EE architecture. In this model, persistent data is represented by EJB Entity Beans.

While EJB Entity Beans are based on the component model of the J2EE architecture, the Java Data Objects Standard keeps to the object model of the Java programming language. JDO therefore allows you to directly make almost every Java class persistent.

 

See also:

Java Persistence Infrastructure

Tables

Relational Persistence

Object Persistence for Java

Locks

Persistence Tools

 

Leaving content frame