Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-24-2022 12:39 PM
I'm working on upgrading a Grails 4 project to Grails 5. As part of that effort, we want to provide support for neo4j v4+ since v3.5 is end of life. We are using GORM v7.2.1 and neo4j Java driver v4.4.5. Java 11 is installed on our test machine. When we simply call the save() method of a domain class, we receive the following error:
org.neo4j.driver.exceptions.ClientException: The old parameter syntax `{param}` is no longer supported. Please use `$param` instead (line 1, column 23 (offset: 22))
CREATE (n:AppVersion {props}) RETURN ID(n) as id
I thought I read somewhere that CYPHER 3.5 queries would work in the newer driver, so any advice on how to resolve this issue would be appreciated.
05-24-2022 02:17 PM
I think the error is just telling you the the old method of injecting parameters by enclosing in brackets is not supported any longer. You have to prepend with a $ sign. It looks it may be interpreting {props} as you injecting parameters. The content between the curly brackets is supposed key/value pairs. The keys have to be literal strings. The values can be values or injected parameters. What does ‘props’ represent in your cypher?
05-24-2022 03:46 PM
Hi Gary, I agree with your interpretation of the error message. The CYPHER query I provided as an example is automatically being generated by GORM, though. It's not a query we wrote ourselves or can modify. So, I'm trying to figure out which version of the neo4j java driver and GORM will work together on a neo4j v4.X database. I'm using the latest version of both, but I'm obviously doing something wrong or there is a bug.
I found a related post that leads me to believe the enclosing brackets should still work and not throw an exception. CYPHER 3.5 prefix does not work in 4.0
05-24-2022 07:11 PM
I did a little research. I see in the GORM for Neo4j documentation that a 'save' will generate a cypher create statement with that syntax. The 'props' is replaced with a map of the GORM entity's properties. I tested the syntax in neo4j v3.x and it worked. I had no idea you could pass a map as a property and set the node's properties with that syntax. I guess it make sense, since you can set the node's binding variable to a parameter that equals a map.
Unfortunately, the version of GORM for Neo4j is using the old neo4j 3.x syntax for referencing parameter values. On neo4j v4, I was able to execute the following: create(n $props)
The GROM homepage states it is built for Neo4j 3.0 and above, but I guess the switch in the 4.x syntax is not supported. I suggest you reach out the GROM authors.
05-26-2022 06:39 AM
I've posted this question to the Grails/GORM authors and community. I will update this post with any information I receive from them.
All the sessions of the conference are now available online