IMPORTANT PRE-REQUISITES
1. Set up environment to compile and run the sample application
The following script must be run for each of the terminal session:
Windows: > quickstart/ttquickstartenv.bat Unix/Linux: $ . quickstart/ttquickstartenv.sh OR
$ source quickstart/ttquickstartenv.csh2. Set up sample database, user accounts and the TPTBM table
The following command should be run once to set up the sample database, user accounts and the TPTBM table.
Windows or Unix/Linux: > cd quickstart/sample_code/orm
> ttIsql -connStr "DSN=sampledb_1121" -f tptbm.sql3. If necessary, install the Apache Ant build tool.
For each ORM framework, an Ant build script is provided to configure, build and execute the application based on the properties of the ORM framework installation. The Apache Ant build tool has to be installed if not present.
After installation, make sure the Operating System environment variable PATH includes the path to the 'ant' executable.
The Ant build scripts have been tested with Apache Ant version 1.6.5.
4. install ORM framework and configure build.properties
Each Ant build script reads values from file quickstart/sample_code/orm/build.properties. This file specifies the locations of build dependencies including the location of the TimesTen JDBC driver jar file and the location of the ORM installation. This file also specifies the common benchmark execution parameters.
Make sure property timesten.jdbc.driver.jar and the home.dir of the ORM installation are set correctly in file build.properties:
- timesten.jdbc.driver.jar=<path to TimesTen JDBC jar file, e.g. D:/TimesTen/tt1121_32/lib/ttjdbc6.jar>
- eclipselink.home.dir=<EclipseLink installation home>, or
- openjpa.home.dir=<OpenJPA installation home>, or
- hibernate.home.dir=<Hibernate installation home>
This application has been tested with EclipseLink 2.0.2 and 2.1.1, OpenJPA 2.0.1 and Hibernate 3.5.6.
How to compile and run the sample ORM application
ORM Framework | Ant build script | Persistence configuration | Compile and Run |
JPA with EclipseLink | 1. Install EclipseLink 2 and then set the required properties listed above in build.properties based on the installation.
2. To build and run the demo execute this sequence of Ant tasks under directory quickstart/sample_code/orm: |
||
JPA with OpenJPA | 1. Install the OpenJPA 2 distribution and set the required properties listed above in build.properties based on the installation.
2. To build and run the demo execute this sequence of Ant tasks under directory quickstart/sample_code/orm: |
||
JPA with Hibernate | 1. Install the Hibernate 3 distribution and set the required properties listed above in build.properties based on the installation.
2. Note that this configuration uses the included Hibernate dialect called TimesTenDialect1121. This dialect is not included in current versions of the Hibernate distribution. The TimesTenDialect1121 class is compiled and packaged into this application. This is the recommended Hibernate dialect for TimesTen 11.2.1 applications. 3. To build and run the demo execute this sequence of Ant tasks under directory quickstart/sample_code/orm: |
||
Hibernate | 1. Install the Hibernate 3 distribution and then set the required properties listed above in build.properties based on the installation.
2. Note that this configuration uses the included Hibernate dialect class called TimesTenDialect1121. It has been optimized for SQL features in TimesTen version 11.2.1. This dialect is not included in current versions of the Hibernate distribution. The TimesTenDialect1121 class is compiled and packaged into this application. This is the recommended dialect for applications that use TimesTen version 11.2.1 or greater. 3. To build and run the demo execute this sequence of Ant tasks under directory quickstart/sample_code/orm: |
Troubleshooting
While building the application with newer versions of the Hibernate distribution, the following error may occur:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
The reason is that newer versions of the Hibernate distribution use the SLF4J logging facade. SLF4J requires at least one of several available log framework adapter jar files that may not be included in the Hibernate distribution. The error occurs if an SLF4J log adapter jar file is not on the CLASSPATH when running this configuration.
To solve this problem download the SLF4J JDK 1.4 logging adapter jar file for the same version of SLF4J that is included in the Hibernate distribution. SLF4J distributions are available at http://www.slf4j.org/dist/.
For example, if the Hibernate distribution includes the slf4j-api-1.5.8.jar file then download the corresponding SLF4J 1.5.8 distribution. Extract the slf4j-jdk14-1.5.8.jar file from the distribution and place it in the same Hibernate directory as the slf4j-api-1.5.8.jar file. Additional information on logging can be found at http://www.slf4j.org/ and in the Hibernate documentation.
Hibernate SQL Dialect for TimesTen 11.2.1
TimesTen Quick Start Guide provides a Hibernate SQL Dialect class that helps to avoid SQL syntax incompatibilities for Hibernate applications that use TimesTen.
To compile and configure the TimesTenDialect1121 class for your application, follow these steps:
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <!-- a SessionFactory instance --> <session-factory name="Tptbm"> <!-- properties --> <property name="hibernate.connection.url">jdbc:timesten:TPTBM</property> <property name="hibernate.connection.username"></property> <property name="hibernate.connection.password"></property> <property name="hibernate.connection.driver_class">com.timesten.jdbc.TimesTenDriver</property> <property name="hibernate.dialect">org.hibernate.dialect.TimesTenDialect1121</property> <property name="hibernate.connection.isolation">2</property> <property name="hibernate.jdbc.fetch_size">32</property> <property name="hibernate.jdbc.batch_size">256</property> <property name="hibernate.jdbc.batch_versioned_data">true</property> <property name="hibernate.jdbc.use_streams_for_binary">false</property> <property name="hibernate.jdbc.use_get_generated_keys">false</property> <property name="hibernate.jdbc.use_scrollable_resultset">false</property> <property name="hibernate.cache.use_query_cache">false</property> <property name="hibernate.cache.use_second_level_cache">false</property> <property name="hibernate.show_sql">false</property> <property name="hibernate.connection.pool_size">4</property> <!-- mapping file --> <mapping resource="META-INF/Tptbm.hbm.xml"/> </session-factory> </hibernate-configuration>
For more information on Java programming with Oracle TimesTen, refer to the Oracle TimesTen In-Memory Database Java Developer's Guide.
Home | Site Map | Contact Us | Copyright © 2011 |