I want to know about neo4j dsl recommendation in Spring data neo4j framework.
As of now I used to create repository interface extending from GraphRepository
, NamedIndexRepository
etc. and write my custom methods with my custom cypher query with @Query
annotation as below:
@Query(value="START root=node:__types__(className='com.data.EntityNode') WHERE root.id={0} and "
+ "root.type={1} return root")
T findByIdAndType(String id, String type);
above method works nicely as far as I consider the static query. but right now I am in need to use some other way where I can generate cypher query depending upon my need !. then I came across neo4j dsl library which looks like a solution to my requirement.
ref: link-1 link-2
My question is:
neo4j dsl
lib in Spring data neo4j (I am using v2.1.0 RELEASE) ? or@Query
value)? because if yes then I dont have to add major changes to my existing design.Thanks
Not an answer, but some feedback:
The Cypher-DSl https://github.com/neo4j-contrib/cypher-dsl has been rebooted last year and is now an integral part of Spring Data Neo4j 6.
Our new docs spot an example: https://docs.spring.io/spring-data/neo4j/docs/6.0.5/reference/html/#faq.custom-queries-and-custom-mappings All statements build from the DSL can be passed to the Neo4j Template.
I hope someone finds this useful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.