Preface

Hibernate is an Object/Relational Mapping (ORM) solution for programs written in Java and other JVM languages.

While a strong background in SQL is not required to use Hibernate, a basic understanding of its concepts is useful - especially the principles of data modeling. Understanding the basics of transactions and design patterns such as Unit of Work are important as well.

1. Obtaining Hibernate NoSQL

Hibernate NoSQL is broken into a number of modules/artifacts under the org.hibernate.nosql group and depends on Hibernate ORM under the org.hibernate.orm group. The main artifact is named hibernate-core and then there is a module/artifact for every supported NoSQL database.

This guide uses 1.0.0.Alpha2 as the Hibernate NoSQL version for illustration purposes. Be sure to change this version, if necessary, to the version you wish to use.

We can declare a dependency on this artifact using Gradle

dependencies {
  implementation "org.hibernate.nosql:hibernate-neo4j:1.0.0.Alpha2"
}

or Maven:

<dependency>
    <groupId>org.hibernate.nosql</groupId>
    <artifactId>hibernate-neo4j</artifactId>
    <version>1.0.0.Alpha2</version>
</dependency>

1.1. Hibernate NoSQL modules

As mentioned earlier, Hibernate NoSQL is broken into a number of modules with the intent of isolating transitive dependencies for the respective NoSQL database that is in use.

Table 1.1: API-oriented modules

hibernate-nosql-core

A JNoSQL implementation of Hibernate ORM

Table 1.2: NoSQL database modules

hibernate-milvus

Support for the Milvus database

hibernate-neo4j

Support for the Neo4j database

1.2. Platform / BOM

Hibernate NoSQL also provides a platform (BOM in Maven terminology) module which can be used to align versions of the Hibernate NoSQL modules along with the versions of its libraries. The platform artifact is named hibernate-platform.

To apply the platform in Gradle

dependencies {
  implementation platform "org.hibernate.nosql:hibernate-platform:1.0.0.Alpha2"

  // use the versions from the platform
  implementation "org.hibernate.nosql:hibernate-neo4j"
  implementation "jakarta.transaction:jakarta.transaction-api"
}

See the Gradle documentation for capabilities of applying a platform.

To apply the platform (BOM) in Maven

<dependency>
    <groupId>org.hibernate.nosql</groupId>
    <artifactId>hibernate-neo4j</artifactId>
</dependency>
<dependency>
    <groupId>jakarta.transaction</groupId>
    <artifactId>jakarta.transaction-api</artifactId>
</dependency>

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.hibernate.nosql</groupId>
      <artifactId>hibernate-platform</artifactId>
      <version>1.0.0.Alpha2</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

1.3. Example sources

The bundled examples mentioned in this tutorial can be downloaded from here.

Alternatively, the example source code can also be obtained from Github

2. Credits

The full list of contributors to Hibernate ORM can be found on the GitHub repository.

The following contributors were involved in this documentation:

  • Christian Beikov