Spring Data Neo4J + QuerydslPredicateExecutor General Question

Is querydsl suppported in the latest Spring Boot relase (2.1.3)? If so, does anyone have some working example code?

If its not supported, are there any other dynamic query builders that can be used.


I assume that you mean something like a querydsl-cypher module?
No, this is not available and Spring Data Neo4j has not prioritized this as a feature because typically using a Spring Data module would imply that you want a certain kind of abstraction and Domain Driver Design support by using repositories for your requests.

It is officially stated that it is not supported in SDN

But dynamic query builders help developers to write code more intuitively. Why it is not prioritized?
As much as I got from your answer is that it is more effective to write Cypher code with @Query annotation than build it with code? Have you ever worked with Query Dsl library (Querydsl Reference Guide) or Mongo, Elastic dynamic query builders?

It would be one of the greatest features which would be developed for Cypher. This would save our time a lot.
So I guess Java engineer should not write Cypher codes, instead should build queries with java code.
That would be great to have some MongoTemplate like Neo4JTemplate to build dynamically queries instead of writing Cypher code string on the repo methods.
Actually I am new in Neo4J (have worked with Postgres, Mongo, ElasticSearch // all of them have such kind of clients to build dynamically queries with java code) world so that was a surprise, not finding such kind of libs in Neo4J world.
So if I don't understand smth important, please explain.

There is a yet experimental CypherDSL in Spring Data Neo4j RX to get used with Neo4jTemplate.
Current ideas around getting it into the @Query annotation are discussed and will get into one of the next releases. Provide a way of defining custom queries in a static, type safe way. · Issue #181 · neo4j/sdn-rx · GitHub

Thank you for your very quick response.
It would be great to see such a great client to dynamically build queries. Actually I guess that is smth that attracts us, developers, to choose some technologies over the others. I guess many developers will agree that they are more eager to write java or some other programming language code than db script code. I don't want to say that it is very complicated to write,, no. Cypher is one of the great languages in db world I guess. I really liked it, but there is more need for Cypher when someone is a data specialist and wants to analyze the data or smth else.
But many of us , for example, Java engineers,, want to push ctrl+space and see what you have there and logically or reading docs write java code. :smiley:
The elasticsearch client and mongo template are one of the best that is why they are attractive when making a decision to choose them. That is my opinion,, and I guess when you will have such kind of clients you will really get on tops. I think so ))) Because the way graph dbs work is really changing the world.
Anyway, I really have an enthusiasm for working with your product. Thanks for your great work what you have developed :slight_smile:

And also forgot the questions:

  1. Why it is only for RX?
  2. I have noticed that in old versions of spring data neo4j there was usage of Cypher-DSL with Query-DSL the Mysema dependencies. Good Relationships: The Spring Data Neo4j Guide Book
    But in new verisons there is no org.springframework.data.neo4j.querydsl.SDNAnnotationProcessor.
    It really interested me.

Is a complete new implementation and we eat our dog food first before we may extract it as a stand-alone library. At the moment this is still experimental as I said before and changing on a fast pace.
Also Spring Data Neo4j RX is planned to be the substitute of Spring Data Neo4j in the future.

It is not intended to be a QueryDSL extension and generate classes but has it focus on generating (complex) Cypher right now. We might extend it and use it for a QueryDSL functionality but first we need to get its API more stable.
There are still features we have on our list that require changes on the CypherDSL, so step-by-step ;)
Thanks for your valuable feedback.

1 Like