Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-10-2022 11:46 PM
Hi guys,
I run this cypher with a browser and its works fine.
:auto MATCH (s:Person)-[r:Friend]->(t:Person)
with s,t,collect(r) as rs
where size(rs) > 1
call{
with rs
CALL apoc.refactor.mergeRelationships(rs,{properties:{`.*`: 'discard'}}) YIELD rel RETURN count(*) as d
} IN TRANSACTIONS OF 100000 ROWS RETURN d
but when I run it in my plugin or java driver shows the below error
Caused by: org.neo4j.exceptions.SyntaxException: Invalid input ':':
":auto MATCH (s:Person)-[r:Friend]->(t:Person)"
^
And when I remove the :auto get this error:
A query with 'CALL { ... } IN TRANSACTIONS' can only be executed in an implicit transaction, but tried to execute in an explicit transaction.
How can I run cypher with auto command in java driver or plugin?
Thank you in advance for your attention
Solved! Go to Solution.
12-11-2022 11:54 AM
The 'call{} in transactions' clause only works with implicit transactions; as such, it will not work with a write transaction function. It will work in an implicit transition. Try executing the cypher using session.run(cypher, params) instead of session.writeTransaction(tx->tx.run(cypher, params)). It will not need ':auto' in this case.
12-11-2022 11:54 AM
The 'call{} in transactions' clause only works with implicit transactions; as such, it will not work with a write transaction function. It will work in an implicit transition. Try executing the cypher using session.run(cypher, params) instead of session.writeTransaction(tx->tx.run(cypher, params)). It will not need ':auto' in this case.
12-12-2022 12:19 AM
Thank you
session.run(cypher, params) is work.
All the sessions of the conference are now available online