cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to convert to Neo4J Value Java Bolt Driver

timojannejokine
Node Link

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.

1 ACCEPTED SOLUTION

brant_boehmann
Node Clone

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

View solution in original post

2 REPLIES 2

brant_boehmann
Node Clone

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

Thanks, I converted the objects to a map and now it works

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.