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.

ERROR Found more than one matching @RelationshipEntity for (1565)-[CONTAINS]->(1560) but cannot tell which one to use

myshareit
Node Clone

In SDN 5 application I had one @RelationshipEntity declared and everything worked fine:

@RelationshipEntity(type = "CONTAINS")
public class DecisionGroupRelationship {

    @Id
    @GeneratedValue
    private Long graphId;

    @StartNode
    private Decision decision;

    @EndNode
    private DecisionGroup group;

Now I added the second following @RelationshipEntity:

@RelationshipEntity(type = "CONTAINS")
public class GroupProfileRelationship {

    @Id
    @GeneratedValue
    private Long graphId;

    @StartNode
    private ProfileGroup group;

    @EndNode
    private Profile profile;

and now receiving a lot of ERRORs in the log:


2021-06-21 15:16:35.346 ERROR 24796 --- [           main] org.neo4j.ogm.context.GraphEntityMapper  : Found more than one matching @RelationshipEntity for (1565)-[CONTAINS]->(1560) but cannot tell which one to use

but the application still working fine.

What am I doing wrong and how to fix it ?

2 REPLIES 2

It looks like Neo4j-OGM cannot determine which RelationshipEntity to apply.
Could you please provide the NodeEntity in question? Also it would be helpful to know the exact versions of SDN and Neo4j-OGM you are using.

myshareit
Node Clone

Looks like I had an ambiguity in my entity mappings. Previously I had something similar to:

@NodeEntity
public class Decision extends BaseEntity {

private static final String CONTAINS = "CONTAINS";

@Relationship(type = CONTAINS, direction = Relationship.INCOMING)
private Set<DecisionGroup> parentGroups;

@Relationship(type = CONTAINS, direction = Relationship.OUTGOING)
private Set<DecisionGroup> childGroups;

but right now switched to:

@NodeEntity
public class Decision extends BaseEntity {

private static final String CONTAINS = "CONTAINS";

@Relationship(type = CONTAINS, direction = Relationship.INCOMING)
private Set<GroupDecisionRelationship> parentGroupRelationships = new HashSet<>();

@Relationship(type = CONTAINS, direction = Relationship.OUTGOING)
private Set<DecisionGroupRelationship> childGroupRelationships = new HashSet<>();

and the issue is gone