Show TOC

Developing PersistenceLocate this document in the navigation structure

Use

The AS Java 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 AS Java provides solutions that are tailored to these requirements. These solutions consist of various interfaces for defining, displaying, and manipulating persistent data.

Benefits

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 AS Java 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.

    More information:

    Table Buffer

    Statement Pooling

  • Maintainability

    Database accesses are validated as early as possible before they are executed in the database. During operation, the AS Java provides many options for viewing and examining database accesses of an application in detail.

More information: Overview of the Java Persistence Infrastructure

Persistence Technologies

Object-relational Persistence

Object persistence provides an object-oriented view of persistent data. Application developers do not manually write SQL statements to manage tables. Instead, the application works directly with Java objects that are automatically synchronized with the database. 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. AS Java provides implementations of the following standards for object-oriented persistence:

  • Java Persistence API (JPA) 1.0

    This is a unified, lightweight persistence model defined by the Java EE 5 standards. In the JPA, entities are Plain Old Java Objects (POJOs) that benefit from a standardized object relational mapping using annotations. Entities support inheritance, polymorphism, and optimistic locking.

    JPA is the recommended programming model for your new application development projects.

    More information:

    Overview of the Java Persistence API

    Using JPA in the Persistence Layer

    Note

    For backward compatibility, AS Java provides runtime support for Java Data Objects (JDO) and container-managed entity beans (EJB CMP) programming models to enable deployment of your existing applications. However, the above programming models are not recommended for development of new applications.

    For more information about JDO (in case you need to support the source code of existing applications), you can refer to the SAP NetWeaver 7.0 documentation on the SAP Help Portal at http://help.sap.com/saphelp_nw04s/helpdata/en/91/7917fab0279f418e33762cbbfa6470/frameset.htm.

Relational Persistence

If applications access data in a relational database directly, you can use the Open SQL/JDBC technology. It is an implementation of the JDBC standard within the Open SQL for Java framework. JDBC is a programming interface that is used at runtime to dynamically compile SQL statements from application code and send them to the database.

More information: Using Open SQL/JDBC in the Persistence Layer

You can also use Native or Vendor SQL with JDBC to utilize the proprietary features of the databases. The advantages of using Open SQL, however, are that it enables you to develop portable applications.