Skip to content

Releases: neo4j/neo4j-java-driver

6.0.1

03 Oct 10:32
82f74a1
Compare
Choose a tag to compare

The neo4j-java-driver-bom has been updated to not import netty-bom.

If you are using Netty Native Transport, please ensure to either:

  • Use a compatible Netty Native Transport version with Netty version used by the driver.
  • Import netty-bom with the desired Netty version (at present, the driver is shipped with Netty 4.2+)

6.0 API documentation

👏 Improvements


  • feat(bom): delete netty-bom from neo4j-java-driver-bom #1707

6.0.0

01 Oct 15:09
f96a053
Compare
Choose a tag to compare

This release brings news features, general improvements and dependency updates.

The sections below describe the main updates in this release and the full changelog is listed in the end.

Java Driver Manual

6.0 API documentation

Neo4j Vector


Neo4j Vector is a new data type introduced in Neo4j server (2025.10, Enterprise Edition).

The driver's type system has been extended to support it.

A new Vector interface represents Neo4j Vector. At present, it has 6 subtypes:

  • Int8Vector - INTEGER8 vector that has Java byte elements and can be converted to byte[] array
  • Int16Vector - INTEGER16 vector that has Java short elements and can be converted to short[] array
  • Int32Vector - INTEGER32 vector that has Java int elements and can be converted to int[] array
  • Int64Vector - INTEGER vector that has Java long elements and can be converted to long[] array
  • Float32Vector - FLOAT16 vector that has Java float elements and can be converted to float[] array
  • Float64Vector - FLOAT vector that has Java double elements and can be converted to double[] array

Similarly to the IsoDuration, new Value instance containing Vector can be created using one of the provided Values#vector(...) factory methods. The Type of such Value is equal to TypeSystem#VECTOR().

Usage example:

var value = Values.vector(new float[] {0.0f});
var result = driver.executableQuery("CREATE (:VectorTest {vector: $vector})")
        .withParameters(Map.of("vector", value))
        .execute();

Since Vector is a sealed interface, it works well with Pattern Matching for switch:

switch (value.asVector()) {
    case Int8Vector int8Vector -> {
        var arr = int8Vector.toArray();
    }
    case Int16Vector int16Vector -> {
        var arr = int16Vector.toArray();
    }
    case Int32Vector int32Vector -> {
        var arr = int32Vector.toArray();
    }
    case Int64Vector int64Vector -> {
        var arr = int64Vector.toArray();
    }
    case Float32Vector float32Vector -> {
        var arr = float32Vector.toArray();
    }
    case Float64Vector float64Vector -> {
        var arr = float64Vector.toArray();
    }
}

Alongside Value#asVector(), it is also possible to map Value to Vector using the Value#as(Class<T>) method. This is especially useful when Vector subtype is well-known:

var vector = value.as(Float32Vector.class);

It is also possible to map to array directly:

var arr = value.as(float[].class);

When using Object Mapping, it is possible to define record components both as Vector and arrays with Vector annotation:

record DomainRecord(
        Float32Vector float32Vector, 
        @Vector float floatArr) {}
var domainRecord = value.as(DomainRecord.class);

Unsupported Type


The Neo4j Vector is a good example of a new type being introduced to the system. It is possible that at some point the driver version connecting to the server might not support a new future type because it requires a newer protocol version to support it.

A new UnsupportedType object has been introduced to identify such types and provide some information about them, like:

  • name
  • minimum protocol version
  • an optional message

The Type of a Value with UnsupportedType is equal to TypeSystem#UNSUPPORTED().

Usage example:

var unsupportedType = value.asUnsupportedType();
System.out.println(unsupportedType.name());
System.out.println(unsupportedType.minProtocolVersion());
unsupportedType.message().ifPresent(System.out::println);

Sending the UnsupportedType back to the server is not supported.

Bill of Materials (BOM)


A new Maven artifact neo4j-java-driver-bom represents driver's Bill of Materials (BOM).

It is especially useful when additional driver dependencies are used.

Usage example (Maven):

<dependencies>
    <dependency>
        <groupId>org.neo4j.driver</groupId>
        <artifactId>neo4j-java-driver</artifactId>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.neo4j.driver</groupId>
            <artifactId>neo4j-java-driver-bom</artifactId>
            <type>pom</type>
            <scope>import</scope>
            <version>6.0.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>

The driver BOM also imports netty-bom to ensure compatible versions, especially when Netty Native Transport is used.

Should it be necessary, users can override netty-bom version by importing it before the driver BOM:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-bom</artifactId>
            <version>${netty-bom.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.neo4j.driver</groupId>
            <artifactId>neo4j-java-driver-bom</artifactId>
            <type>pom</type>
            <scope>import</scope>
            <version>6.0.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Query API


NOTE: This feature is in preview.

Neo4j Query API is an HTTP API for executing Cypher statements.

The driver supports connecting to this API over HTTP.

The Query API support is enabled by:

  • including an extra dependency
  • using https or http URI scheme

Example (Maven):

<dependencies>
    <dependency>
        <groupId>org.neo4j.driver</groupId>
        <artifactId>neo4j-java-driver</artifactId>
    </dependency>
    <dependency>
        <groupId>org.neo4j.bolt</groupId>
        <artifactId>neo4j-bolt-connection-query-api</artifactId>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <!--> BOM ensures the versions are compatible <-->
        <dependency>
            <groupId>org.neo4j.driver</groupId>
            <artifactId>neo4j-java-driver-bom</artifactId>
            <type>pom</type>
            <scope>import</scope>
            <version>6.0.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Driver creation example:

var driver = GraphDatabase.driver("https://query.api.local", authToken);

The are some limitations with this integration at the moment. The main unsuported items are listed below:

  • Home database resolution.
  • Records streaming.
    • All records are loaded ahead of time to client-side memory. If you deal with large datasets, this integration might need more memory.
  • Neo4j Vector.
  • Unsupported Type.
  • Transaction metadata.
  • Notification preferences.
  • ResultSummary#resultAvailableAfter(TimeUnit).
  • ResultSummary#resultConsumedAfter(TimeUnit).
  • ResultSummary#queryType().
  • ResultSummary#plan().
  • ResultSummary#profile().

Since home database resolution is not supported, the database name MUST be set explicitly using the driver API. Alternatively, it is possible to append the default database name to the URI, it will be used when no database name is set explicitly.

Example: https://query.api.local?defaultDatabase=neo4j

Reducing the number of dependencies

When the driver is used with Query API only, it is possible to exclude some dependencies to reduce the overall amount:

<dependency>
    <groupId>org.neo4j.driver</groupId>
    <artifactId>neo4j-java-driver</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.neo4j.bolt</groupId>
            <artifactId>neo4j-bolt-connection-netty</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Specifically, this removes the following dependencies:

  • org.neo4j.bolt:neo4j-bolt-connection-netty
    • io.netty:netty-handler
      • io.netty:netty-common
      • io.netty:netty-resolver
      • io.netty:netty-buffer
      • io.netty:netty-transport
      • io.netty:netty-transport-native-unix-common
      • io.netty:netty-codec-base
    • io.netty:netty-tcnative-classes

Unix Domain Socket


bolt+unix URI scheme allows connecting to Neo4j server over Unix Domain Socket.

Example:

try (var driver = GraphDatabase.driver("bolt+unix:///var/run/neo4j.sock")) {
    var result = driver.executableQuery("SHOW DATABASES")
            .withConfig(QueryConfig.builder().withDatabase("system").build())
            .execute();
    result.records().forEach(System.out::println);
}

While the driver does not impose any special limitations on such connections, the server has a dedicated purpose for them - administration. Therefore, it limits interations to system database only. See the server configuration settings.

Netty Native Transport


Using Netty Native Transport may bring better performance and less garbage collection as mentioned in the Netty documentation.

In addition, ...

Read more

5.28.10

29 Sep 13:11
1a35f24
Compare
Choose a tag to compare

This in an LTS release.

It brings general improvements and dependency updates.

5.28 API documentation

👏 Improvements


  • docs(retries): add a note about implicit transaction #1688
  • test: fix ReactiveResultRecordPublisherVerificationIT #1703

🔧 Dependency Management


  • build(deps): update dependencies #1702

6.0.0-RC1

24 Sep 19:36
37bc83e
Compare
Choose a tag to compare
6.0.0-RC1 Pre-release
Pre-release

This is the first release candidate that provides a preview of the new features and general improvements.

6.0 API documentation

⭐ New Features


  • feat(tfo): add experimental support for TFO #1696
  • feat(unix): add support for bolt+unix #1700
  • feat(unsupportedType): add support for Bolt Unsupported Type #1691

👏 Improvements


  • feat(vector): add Value#asVector() #1701
  • feat(tfo): update config naming #1699
  • test: fix ReactiveResultRecordPublisherVerificationIT #1695
  • feat(vector): update naming #1692
  • fix(acquisition): avoid infinite connection timeout if there is a limit #1689
  • feat(native): add support for Netty native transports #1690
  • docs(retries): add a note about implicit transaction #1687
  • feat(acquisition): apply acquisition timeout to all steps #1685
  • feat(observability): allow setting null provider #1686

🔧 Build


  • build(deps): update dependencies #1694

4.4.21

12 Sep 14:35
c542814
Compare
Choose a tag to compare

This is a refinement release that brings dependency updates.

4.4 API documentation

👏 Improvements


  • docs: Update Driver#close() and Driver#closeAsync() documentation #1635
  • test: fix SessionIT, AsyncSessionIT, AsyncTransactionIT run failures #1697

🔧 Dependency Management


  • build(deps): update dependencies #1698

6.0.0-beta01

13 Aug 16:42
e618774
Compare
Choose a tag to compare

This is the first beta release that provides a preview of the new features and general improvements.

6.0 API documentation

⭐ New Features


  • feat(observability): add Observation SPI #1682

👏 Improvements


  • feat(observability): add Javadoc #1684
  • fix(object-mapping): try making record components accessible #1681
  • docs(retry): mention ExecutableQuery in withMaxTransactionRetyTime #1679

🔧 Build


  • build(deps): update dependencies #1683

6.0.0-alpha03

16 Jul 14:22
f4f70ed
Compare
Choose a tag to compare

This is the third alpha release that provides a preview of the new features and general improvements.

6.0 API documentation

👏 Improvements


  • feat(gql-status-object): add legacy notification fields #1677

🔧 Build


  • build(deps): update dependencies #1680

5.28.9

15 Jul 10:10
a02447f
Compare
Choose a tag to compare

This in an LTS release.

It brings general improvement and dependency update.

5.28 API documentation

👏 Improvements


  • feat(gql-status-object): add legacy notification fields #1676

🔧 Dependency Management


  • build(deps): udpate dependencies #1678

6.0.0-alpha02

09 Jul 15:04
3cb1b14
Compare
Choose a tag to compare

This is the second alpha release that provides a preview of the new features and general improvements.

6.0 API documentation

⭐ New Features


  • feat(vector): Introduce support for Neo4j Vector #1663

👏 Improvements


  • feat(gql-status-object): Introduce GqlNotification #1667
  • feat(object-mapping): support mapping types with restricted access #1668
  • feat(gql-status-object): make GQL Status Object GA #1669
  • feat(gql-error): add GQLSTATUS finders #1671
  • feat(gql-error): make GQL Error GA #1673
  • fix(retry): make RetryLogic executor threads daemon #1661
  • perf(value): optimise value handling for Bolt Connection #1657

🔧 Build


  • build(deps): update neo4j-bolt-connection to 6.0.1 #1664
  • build(deps): update dependencies #1674

5.28.8

09 Jul 17:50
981f7a2
Compare
Choose a tag to compare

This in an LTS release.

It brings general improvements and dependency updates.

5.28 API documentation

👏 Improvements


  • feat(gql-status-object): Introduce GqlNotification #1641
  • feat(object-mapping): support mapping types with restricted access #1670
  • feat(gql-error): add GQLSTATUS finders #1672

🔧 Dependency Management


  • build(deps): update dependencies #1675