Using NuoDB with Hibernate

Overview

NuoDB provides explicit support for Java applications using Hibernate object-relational mapping:

  • A NuoDB specific dialect for mapping to NuoDB specific SQL.

  • Custom Driver and Connection classes, specifically designed for Hibernate.

    • Allow NuoDB to throw appropriate Hibernate exceptions related to connection errors.

  • Packaged in nuodb-hibernate.jar.

Our Hibernate drivers released before Jan 2021 has a dependency on Hibernate in order to throw the appropriate Hibernate exceptions.
If you try to use the driver without Hibernate JARs on the CLASSPATH, you will get a ClassNotFoundException due to the missing StateStateException class.
This most commonly occurs when using NuoDB as a JNDI resource in Web or JEE/Jakarta containers.

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 5 of Hibernate. The NuoDB JDBC driver must be installed in addition to the nuodb-hibernate.jar.

Both drivers require Java 8 or 11.

Installation

The Hibernate and JDBC JARs are published via Sonatype to Maven Central so that you can declare a dependency in your Gradle, Ivy or Maven build files. For the Maven URL required to download JAR files, see NuoDB Drivers Available at Other Public Sites.

NuoDB Driver JARs have a version number independent of NuoDB releases, starting with version 20.0.0.

Two versions of the NuoDB Hibernate JAR are available:

  • 20.0.0-hib3 for use with Hibernate 3.6.6.

  • 20.xxx-hib5 for use with Hibernate 5.3 or 5.4.

The version numbers NN.xxx are subject to change. For all releases of our Hibernate JAR, go to MVN Repository.

If you would like a local copy of the jars, you can download them manually from Maven Central (see link above). Just locate the web page for the version you require, identify the Files row in the table at the top and click the jar link.

Hibernate 3 Dependencies

<!-- Maven POM -->
<dependency>
  <groupId>com.nuodb.hibernate</groupId>
  <artifactId>nuodb-hibernate</artifactId>
  <version>20.0.0.hib3</version>
</dependency>
<dependency>
  <groupId>com.nuodb.jdbc</groupId>
  <artifactId>nuodb-jdbc</artifactId>
  <version>22.xxx</version>
</dependency>

<!-- Gradle Build -->
compile group: 'com.nuodb.hibernate', name: 'nuodb-hibernate', version: '20.0.0.hib3'
compile group: 'com.nuodb.jdbc', name: 'nuodb-jdbc', version: '22.xxx'

<!-- Ivy XML -->
<dependency org="com.nuodb.hibernate" name="nuodb-hibernate" rev="20.0.0.hib3"/>
<dependency org="com.nuodb.jdbc" name="nuodb-jdbc" rev="22.xxx"/>

Hibernate 5 Dependencies

<!-- Maven POM -->
<dependency>
  <groupId>com.nuodb.hibernate</groupId>
  <artifactId>nuodb-hibernate</artifactId>
  <version>20.xxx-hib5</version>
</dependency>
<dependency>
  <groupId>com.nuodb.jdbc</groupId>
  <artifactId>nuodb-jdbc</artifactId>
  <version>22.xxx</version>
</dependency>

<!-- Gradle Build -->
compile group: 'com.nuodb.hibernate', name: 'nuodb-hibernate', version: '20.xxx-hib5'
compile group: 'com.nuodb.jdbc', name: 'nuodb-jdbc', version: '22.xxx'

<!-- Ivy XML -->
<dependency org="com.nuodb.jdbc" name="nuodb-jdbc" rev="22.xxx"/>
<dependency org="com.nuodb.hibernate" name="nuodb-hibernate" rev="20.xxx-hib5"/>