Skip to content

Retrieval of single object not possible, if other fields use the same relation type #182

Description

@SebastianWendorf

The graph has the following relations:

(:Class)-[:DECLARES]->(:Constructor)
(:Class)-[:DECLARES]->(:Method)
(:Class)-[:DECLARES]->(:Property)

In code they are modeled as:

@Relation("DECLARES")
ConstructorDeclarationDescriptor getConstructor();
void setConstructor(ConstructorDeclarationDescriptor constructor);

@Relation("DECLARES")
List<PropertyDeclarationDescriptor> getProperties();

@Relation("DECLARES")
List<MethodDeclarationDescriptor> getMethods();

The problem is, that when I call myClassDescriptor.getConstructor() to retrieve the constructor field I get:
org.neo4j.graphdb.NotFoundException: More than one relationship[DECLARES, OUTGOING] found for Node

The retrieval of the properties and methods fields work fine.

Full Stacktrace:

org.neo4j.graphdb.NotFoundException: More than one relationship[DECLARES, OUTGOING] found for Node[2532]

	at org.neo4j.kernel.impl.core.NodeEntity.getSingleRelationship(NodeEntity.java:209)
	at com.buschmais.xo.neo4j.embedded.impl.model.EmbeddedNode.getSingleRelationship(EmbeddedNode.java:62)
	at com.buschmais.xo.neo4j.embedded.impl.datastore.EmbeddedRelationManager.getSingleRelation(EmbeddedRelationManager.java:76)
	at com.buschmais.xo.neo4j.embedded.impl.datastore.EmbeddedRelationManager.getSingleRelation(EmbeddedRelationManager.java:20)
	at com.buschmais.xo.impl.EntityPropertyManager.getEntityReference(EntityPropertyManager.java:60)
	at com.buschmais.xo.impl.proxy.entity.property.EntityReferencePropertyGetMethod.invoke(EntityReferencePropertyGetMethod.java:16)
	at com.buschmais.xo.impl.proxy.AbstractProxyMethodService.invoke(AbstractProxyMethodService.java:26)
	at com.buschmais.xo.impl.proxy.InstanceInvocationHandler.invoke(InstanceInvocationHandler.java:27)
	at com.sun.proxy.$Proxy103.getConstructor(Unknown Source)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions