Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-04-2020 02:31 AM
Hi,
I'm trying to run a query and pass objects as parameters with the java bolt driver.
try (Session session = driver.session()) {
return session.writeTransaction(transaction -> transaction.run(cypher, params).stream()
.map(function)
.collect(Collectors.toList()));
}
The params object is a map:
Map.of("neighborId", neighbourId, "knowledgeEntry", knowledgeEntry, "knowledgeRecords", knowledgeRecords)
knowledgeEntry is a domain object and knowledgeRecords is a list of domain objects.
If I run this I get the following error:
Unable to convert bkh.backend.model.KnowledgeEntry to Neo4j Value
Are only primitive types allowed as parameters? I found a section in the cypher manual docs that shows how JSON data can be used in cypher as parameters.
Solved! Go to Solution.
02-04-2020 05:25 AM
It's not quite limited to primitives, but it definitely doesn't know about your custom domain object. Here's the types the driver understands how to bind:
https://neo4j.com/docs/driver-manual/current/cypher-workflow/#driver-type-mapping
02-04-2020 05:25 AM
It's not quite limited to primitives, but it definitely doesn't know about your custom domain object. Here's the types the driver understands how to bind:
https://neo4j.com/docs/driver-manual/current/cypher-workflow/#driver-type-mapping
02-11-2020 06:23 AM
Thanks, I converted the objects to a map and now it works
All the sessions of the conference are now available online