Relationship retrieval and its mapping on entity class using cypher neo4j


#1

i am using NEO4J with hibernate OGM java.i am trying to retrieve relationship using cypher query language and then trying to map that relationship with my entity class as i want to get relationship properties…In other word i am trying to get relationship of neo4j as an object so i can get my relationship properties…my application uses EJB ,JPA and hibernate ogm with neo4j can anyone help?


#2

Hi,
we have already talked in chat but I will answer here as well for others.

At the moment, it’s not possible to do this with the Bolt or Http protocol (it should work with embedded).
The reason is that JPA does not have any similar concept for associations.

The only thing you can do is to use native queries. In this case Hibernate OGM will return the object the same way the underlying client is returning it. For example, if you are using Bolt, it will return an InternalRelationship.

We have an open issue for proposing better ways to deal with relationships: https://hibernate.atlassian.net/browse/OGM-920

It doesn’t cover exactly your use case but maybe you can leave a comment and describe what you need so that when we will work on the feature we will keep that in mind.

Thanks,
Davide