Cypher-DSL Releases

Hi, Michael here, from team SDN-OGM. We are planning to announce new releases of the Cypher-DSL here, too.

The Cypher-DSL is a spin-off from our work on SDN6 and is a fully supported Neo4j module as SDN6 uses it all the way under the hood. It provides the Cypher-DSL executor in SDN6 as well as the Query-DSL integration.
It provides the basis for Neo4j-GraphQL-Java, too.

So, without much further ado, the latest release is 2022.1.0 from earlier this month:

GitHub

Release 2022.1.0 · neo4j-contrib/cypher-dsl

No breaking changes. The minor version has been incremented to notify about new default methods in our interfaces. Those shouldn't concern you as a user though, as they are not meant to be implemen...

As you see, we are using CalVer, so that you get a quick idea roughly when a version was released. Since the 2022.0.0 release, we obey semver and will bump minor and patch versions accordingly so that you won't run into unexpected, breaking changes. Also since that release, all public API marked as such is stable and safe to use.

This also applies for the (optional) Cypher-Parser module (that parses Cypher into Cypher-DSL elements) and the generator module (that reads Spring Data Neo4j 6 annotated classes) and generates a static model for you that you can use to build queries.

Some use cases:

  • Do you need to build the queries in an iterative fashion
  • Do you need to rewrite part of a query? The parser module is an excellent choice
  • Can you can generate parts of the query from a static model such as SDN6? The generate module is for you

If you are on JDK 17 and your query doesn't change all that much, a multiline String, with correct Cypher-Parameters is of course 100% fine.

Last but not least: The Cypher-DSL does not depend in any way or form of the Java-Driver but it can be absolutely used with it. Not only you can use it to build your queries and give them to the driver, you can also build executable statements which takes care of all the boiler plate code of dealing with sessions etc. for you. Have a look at the manual: Executing statements.

I am using SDN 6. but in this version, I got this type of error: the Caused by: java.lang.IllegalArgumentException: The repository id type class java.lang.String differs from the entity id type class java.lang.Long. at org.springframework.data.neo4j.repository.support.Neo4jRepositoryFactorySupport.assertIdentifierType(Neo4jRepositoryFactorySupport.java:34) at org.springframework.data.neo4j.repository.support.Neo4jRepositoryFactory.getTargetRepository(Neo4jRepositoryFactory.java:72) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:322) at org.springframework.data.util.Lazy.getNullable(Lazy.java:230) at org.springframework.data.util.Lazy.get(Lazy.java:114) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:328) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ... 58 common frames omitted. In my model, I connect the relationship with the self node. so how i resolve this issue?

Here my Model, @Node public abstract class A{
@Id @GeneratedValue @Getter @Setter protected Long id;
}
public class B extends A{
}
public class C extends A{ private String a; private String d; @Relationship(type = "Owner_of", direction = Direction.INCOMING) private B b; @Relationship(type = "Parent_of", direction = Direction.OUTGOING) private C c; } In this structure i get Error.