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.

OGM SDN 6 query by relationship property

Is there a way to use findBy.. to retrieve a subset of a graph model based on a relationship property value?
Example: Given nodes A, B. A is related to node B by R. R has a r.type property. The following model classes exist. A and B are @Node classes and R is a @RelationshipProperties class.

Can I complete a List<A> findByType( String Type) or does the parameter need to be found in the specified model class, A.

Maybe the only way to accomplish this is using a custom query. Then map all the data to model or DTO classes.

1 REPLY 1

Yes, this is possible. You would do this just like any other property based query.

class A {
   List<R> relatedThings;
}

You would define a findByRelatedThingsType(String type) finder method to query for the r.type property in a Neo4jRepository<A,...>.