@Node(value = "Step")
@Data
public final class StepEntity {
@Id
private int number;
@Relationship(type = "DESCRIPTION", direction = Relationship.Direction.INCOMING)
private final List<StepDescEntity> desc;
}
Relationship "DESCRIPTION" Entity
@RelationshipProperties
@Data
public final class StepDescEntity {
@Id
@GeneratedValue
private final Long id;
@TargetNode
private final StepEntity stepEntity;
private final List<String> properties;
}
Cocktail Repository
public interface CocktailRepository extends Neo4jRepository<CocktailEntity, String> {
}
I tried:
findAll() method
using @Query("match (c:Cocktail)-[r:DESCRIPTION]-(s:Step) return c,collect(r),collect(s)")
Hello Evyuel
Just by chance, yesterday I started reading the book, it has detailed examples that show complete integration with Neo4j and Spark, hope this will help you solve the bug.
The examples are very similar to the case you presented, hope this helps.
Regards
Rafi
The main issue is that you have the property String value in the graph but model List<String> properties.
If you would add the property String value in the StepDescEntity, the property will get mapped.
But you did not model the relationship StepDescEntity between Cocktail and StepEntity (from the Cocktail side) but the StepEntity directly.
should fix this.
Also, you do not need to model the relationship bidirectional and can remove the StepDescEntity from the StepEntity. It is recommended (and more performant during the mapping phase) to have a directed graph modeled in the Java world instead of cycles.
I added an example for your use-case here: neo4j-issues-examples/discourse-44037 at master ยท meistermeier/neo4j-issues-examples ยท GitHub
Hello Evyuel
Pages 45-47,
Pages 65-67 describe algorithm how return all Shortest path with Neo4j & Spark.
There is alot exempales with code .
The difference is only in the syntax and examples ,but the ideas are very similar to your case.
Regards
@gerrit.meier You solved my problem!!
My main mistake was that I added to the "target node" class, the repository for which I am using, at the same time a reference "to the entity of the related node" and a reference "to the entity of the relationship".
Instead, I needed to add a reference "to the entity of the relationship" to the "related node entity" rather than the target node.