cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

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.

1 ACCEPTED SOLUTION

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

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