What version of Spring Data Neo4j are you running?
Spring Data Neo4j 5 does not provide any other level of abstraction by itself but uses the Neo4j-OGM under the hood (like Spring Data JPA does it with a JPA implementation).
You could opt-in to use the
SessionFactory that you can get injected into your classes. If you need any more information about this, feel free to reach out.
Spring Data Neo4j 6 (the project that was named SDN/RX during WIP) provides three levels of abstraction:
Neo4jClientNot aware of any mapping that was done but you could describe it as a Neo4j Driver on steroids. It participates in ongoing Spring transactions, has a fluent API for manual mapping etc.
Neo4jTemplateUses the metadata from the domain mapping to provide functionality for handling entities. I think this is basically what you are asking for.
Neo4jRepositoryThe third and highest level of abstraction.
Sorry, I somehow missed the mentioning.
In this case you are running SDN 5 and similar to a JPA EntityManager is the
SessionFactory provided by Neo4j-OGM (that works behind SDN 5).
After you created a
SessionFactory#openSession you can work with this to load and persist your objects.
It is possible to get a pre-configured
SessionFactory and also a
Session injected into your classes, if this is the way you want to use it.
Sessions participate in the Spring transactions, I advise not to mix up repositories and lower-level
You can read more about the
Session usage in the documentation: https://neo4j.com/docs/ogm-manual/current/reference/#reference:session
Now I got your question. No, there is no functionality that is equally to the criteria API.
There is something similar and this is the usage of filters with the
Session-based queries https://neo4j.com/docs/ogm-manual/current/reference/#reference:filters
As I already said here How can we update database in spring boot without using repository - #2 by gerrit.meier there are several solutions.
Neo4jClient with its
query function for custom queries without automatic entity mapping or
Neo4jTemplate (e.g. with its
findAll method) with a CypherDSL (GitHub - neo4j-contrib/cypher-dsl: A Java DSL for the Cypher Query Language) produced statement.