This is an extension for Quarkus.io, depending on the official Quarkus Neo4j Extension. Neo4j-OGM Quarkus configures Neo4j-OGM to use the low-level connectivity provided by the Quarkus Neo4j extension.
This extension is meant to be used on top of Quarkus Neo4j Extension.
It uses the driver provided with the latter to configure Neo4j-OGMs SessionFactory
, so that you can get an instance in
beans like this:
import java.util.Collection;
import jakarta.enterprise.context.ApplicationScoped;
import org.neo4j.ogm.session.SessionFactory;
@ApplicationScoped
public class MovieRepository {
private final SessionFactory sessionFactory;
MovieRepository(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public Collection<Movie> findAll() {
return sessionFactory.openSession().loadAll(Movie.class);
}
}
In addition, it will take care that all classes annotated with @NodeEntity
and @RelationshipEntity
are discovered by
Quarkus in both JVM and native mode.
Note
|
Please note that this extension only supports connections via the Bolt-protocol. |
Maven artifacts are available on central under
the following coordinates: org.neo4j:neo4j-ogm-quarkus:3.10.0
.
Note
|
There is no need to declare any other dependency (for Neo4j-OGM or Quarkus-Neo4j, this extension here brings both of them). |
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-quarkus</artifactId>
<version>3.10.0</version>
</dependency>
The underlying Neo4j-Driver extension is documented in the Quarkiverse: Quarkus Neo4j. The Neo4j-OGM manual is here.
There is little to be configured in this extension itself apart from a few properties:
Configuration property |
Type |
Default |
---|---|---|
🔒 An optional list of packages to scan. If empty, all classes annotated with |
list of string |
|
Should Neo4j native types be used for dates, times and similar? |
boolean |
|
This flag instructs OGM to use all static labels when querying domain objects. |
boolean |
|
The database that should be used (Neo4j EE 4.0+ only). Leave empty for using the default database. |
string |
🔒 Configuration property fixed at build time - All other configuration properties are overridable at runtime
The integration-tests
module is a good candidate for showing how the dependencies flow in the Neo4j-Quarkus ecosystem:
quarkus-neo4j
- the official Quarkiverse extension - sits in the middle. It provides the neo4j-java-driver
, the essential connectivity.
Depending on it are neo4j-ogm-quarkus
(this project) and inside the integration tests, neo4j-migration-quarkus
which runs the Cypher-scripts
with our test data for us.
neo4j-ogm-quarkus
brings the necessary dependencies for Neo4j-OGM itself, and of course, contains all the Quarkus "magic" to make things work
nicely together.