Using the NuoDB Java Hibernate Driver

Overview

NuoDB provides a Hibernate dialect (nuodb-hibernate.jar). In addition to the dialect, the nuodb-hibernate.jar file contains its own Driver and Connection classes, specifically designed for Hibernate. This is in order to be able to throw appropriate Hibernate exceptions related to connection errors. This documentation is not meant to be a full Reference or Programming manual for Hibernate. It is just meant to help you get started with Hibernate and NuoDB.

Requirements

NuoDB supports both versions 3.6.6 and 4.1.x of Hibernate. The NuoDB JDBC driver must be installed in addition to the nuodb-hibernate.jar file.

Caution: NuoDB Hibernate clients prior to release 2.3 may not work with the NuoDB 2.3 or later database processes due to a change in the SQL syntax of the SELECT FETCH clause.

Note: The JDBC driver requires Java 1.7 or newer. The Hibernate driver requires Java 1.8 or newer.

Installation

The NuoDB Hibernate dialect and JDBC driver are installed by default with the product and there are no addition installation steps required. Both jars can be found at:

NUODB_HOME/jar/nuodb-hibernate.jar
NUODB_HOME/jar/nuodbjdbc.jar

In addition, the Hibernate dialect and JDBC jars are published via Sonatype to Maven Central so that you can declare a dependency in your Ivy or Maven build files. For specific up to date details on this, search for "NuoDB" at: http://search.maven.org. The dependency in your POM file would be as follows for these jars:

<dependency>
  <groupId>com.nuodb.hibernate</groupId>
  <artifactId>nuodb-hibernate</artifactId>
  <version>2.6</version>
</dependency>
<dependency>
  <groupId>com.nuodb.jdbc</groupId>
  <artifactId>nuodb-jdbc</artifactId>
  <version>2.6</version>
</dependency>

The version numbers are subject to change.

The mvn commands to install the NuoDB Hibernate and JDBC driver jars are as follows:

$ mvn install:install-file -DgroupId=com.nuodb.jdbc -DartifactId=nuodb-jdbc -Dversion=2.6 -Dpackaging=jar -Dfile=$NUODB_HOME/jar/nuodbjdbc.jar
$ mvn install:install-file -DgroupId=com.nuodb.hibernate -DartifactId=nuodb-hibernate -Dversion=2.6 -Dpackaging=jar -Dfile=$NUODB_HOME/jar/nuodb-hibernate.jar

See the following topics:

Connecting to a Database Using Java Hibernate Driver

Deploying the NuoDB Java Hibernate Dialect with JBoss

Example of Using Java Hibernate Driver