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/orm directory. It includes the following source files:

  Source file Description
Tptbm.java
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.
TptbmPKey.java
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.java
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.

JPAClient.java
This java class inherits the CommonClient abstract class and implements a stand-alone JPA application that uses the EntityManager interface for persistence.
HIBClient.java
This java class inherits the CommonClient abstract class and implements a stand-alone Hibernate application that uses the Hibernate native Session interface for persistence.

Compile and Run: 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.