Introduction

This chapter is an introduction to graph databases, Neo4j, and the Neo4j object-graph mapping library (Neo4j-OGM). It also outlines requirements and where to get support. If you are already familiar with Neo4j and Neo4j-OGM, feel free to jump directly to the tutorial or reference sections.

What is an OGM?

An OGM (Object Graph Mapper) maps nodes and relationships in the graph to objects and references in a domain model. Object instances are mapped to nodes while object references are mapped using relationships, or serialized to properties. JVM primitives are mapped to node or relationship properties. An OGM abstracts the database and provides a convenient way to persist your domain model in the graph and query it without using low level drivers. It also provides the flexibility to the developer to supply custom queries where the queries generated by Neo4j-OGM are insufficient.

Introducing the Neo4j-OGM

Developing Java Business Applications often requires mapping rich domain models to your database. The Neo4j-OGM library is a pure Java library that can persist (annotated) domain objects using Neo4j. It uses Cypher statements to handle those operations in Neo4j.

Neo4j-OGM supports tracking changes to minimize necessary updates and transitive persistence (reading and updating neighborhoods of an object).

The connection to Neo4j handled by a transport layer is based on the Bolt protocol and uses the Neo4j Java Driver.

What’s new in Neo4j-OGM 4 ?

At a high level, here is what has changed in this third major version of Neo4j-OGM :

  • New baselines

    The minimum required versions are Java 17 and Neo4j 5.x.

  • Removal of Auto Index Manager

    The Auto Index Manager that was responsible for creating indexes and constraints out-of-the-box got removed from the Neo4j-OGM.

    Please use tools like Neo4j-Migrations or Liquibase with the Neo4j-Plugin enabled to control your schema. They offer a broader feature set than just focus on indexes and constraints.

    Although the functionality was removed, the interfaces are still available. Those are currently in place to avoid refactoring your codebase and support Neo4j-Migrations' annotation processor to make the transition easier.

  • Removal of HTTP and embedded transport support

    Since Neo4j 4.x Neo4j-OGM did not offer embedded transport but the module was still available for users connecting to a 3.5.x instance. Because the baseline of the official supported database was raised to Neo4j 5.x with this release, the embedded option got deprecated.

    The HTTP transport mode was removed because it was rarely used and could not compete with the broad feature set that Bolt allows you to have.

Requirements

Neo4j-OGM 4.x at minimum, requires:

  • JDK Version 17

  • Neo4j Database 5.x

Additional Resources

Project metadata

Getting Help or providing feedback

If you encounter issues, or you are just looking for advice, feel free to use one of the links below:

Learning more

The jumping off ground for learning about Neo4j is neo4j.com. Here is a list of other useful resources: