ORM (Object-Relational Mapping) Sample Application

This page provides a sample ORM application that demonstrates how to configure and run the Oracle TimesTen In-Memory Database with several different object-relational mapping (ORM) frameworks. The application is a multi-user throughput benchmark program that uses the ORM provider's native API or the EJB 3.0 Java Persistence API (JPA) directly.

The application has been tested with the following ORM frameworks:

The sample ORM application is available in the quickstart/sample_code/j2ee_orm directory. It includes the following source files:

  Source file Description
This is the POJO (Plain Old Java Object) class. An instance of this class corresponds to a unique row in the TPTBM table. Annotations are used to associate properties of the class with the database table.
Each instance of the Tptbm class contains an embedded instance of the TptbmPKey class. TptbmPKey represents the unique ID for a Tptbm. The TPTBM table has a composite primary key consisting of the VPN_NB and VPN_ID table columns. TptbmPKey is mapped to these key columns through the use of annotations.
CommonClient is the base abstract class from which all concrete client classes inherit. CommonClient implements the high level benchmark setup and execution logic. CommonClient also defines the following abstract methods which are implemented by the concrete client classes using a specific persistence API:
  • open ()
  • close ()
  • txnBegin ()
  • txnCommit ()
  • txnRollback ()
  • read ()
  • insert ()
  • update ()
  • deleteAll ()
  • populate ()

To understand how a particular ORM client configuration works with its persistence API, examine the implementation of these methods in the concrete client classes described below.

This java class inherits the CommonClient abstract class and implements a stand-alone JPA application that uses the EntityManager interface for persistence.
This java class inherits the CommonClient abstract class and implements a stand-alone Hibernate application that uses the Hibernate native Session interface for persistence.
The Hibernate and "JPA with Hibernate" sample application use the included Hibernate dialect class called TimesTenDialect1122. It has been optimized for SQL features in TimesTen version 11.2.2. This dialect is not included in current versions of the Hibernate distribution. The TimesTenDialect1122 class is compiled and packaged into the tptbmas-hibernate3.jar (tptbmas-hibernate4.jar) or tptbmas-jpa-hibernate3.jar (tptbmas-jpa-hibernate4.jar) file.

This is the recommended dialect for applications that use TimesTen version 11.2.2 or greater.

Compile and Run

Click here to learn how to compile and run the sample application with different ORM frameworks.

For more information on Java programming with Oracle TimesTen, refer to the Oracle TimesTen In-Memory Database Java Developer's Guide.