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 helps you get started with Hibernate and NuoDB.

Requirements

NuoDB supports Hibernate 5.x. 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 Hibernate JAR 20.xxx-hib5 is available for use with Hibernate 5.3 or 5.4.

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

  • The version numbers NN.xxx are subject to change. For all releases of our Hibernate JAR, visit our MVN Repository. To download a local copy of the JARs, click the link and locate jar file on the web page for your specific version of Hibernate.

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"/>