I have a pretty typical situation using the new Spring Data Neo4j-RX, where I'm fetching an object and wanting to get one level of relationships in the resulting object. My stuff was originally written against Neo4j 3.5, with the OGM, and there it worked fine. Because I'm using Kotlin, I want to handle null as the "does not exist" case, rather than Java Optional.
The code is pretty straightforward:
@Query("MATCH (a:Foo {id: \$id})-[r]->(o) RETURN a, r, o")
fun findByIdOrNull(id: String): FooNode?
But this doesn't work. Running the cypher query directly against the driver seems to return the correct structure - we get the parent object, the relationship, and the target object. All the IDs match, etc. But the property in the parent object is left as null.
If I use the regular old findById()
and handle the Optional result, it works fine. It seems like I must be doing something wrong, but I don't know what it is.