Search code examples
javaneo4jspring-data-neo4j-4neo4j-ogm

Access to neo4j-ogm's mapping context


I'm using neo4j-ogm 2.1.1 and I need to clear entities from the neo4j-ogm's mapping context manually.

I need this because I'm deleting entities with custom CYPHER queries and I need to correctly clean the mapping context to remove deleted entities.

Since org.neo4j.ogm.Session is not exposing the context, and I'm not able to cast Session to an Neo4jSession, does someone know how to access this underlying context ?

Or am I in a wrong direction and should I choose a different approach ?


Solution

  • It seems I can use this method on the org.neo4j.ogm.Session:

    session.detachNodeEntity(id)

    It seems to be working fine for what I want.