Unable to convert to Neo4J Value Java Bolt Driver

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.

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:

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

1 Like