Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SebastianWendorf opened this issue Nov 23, 2023 · 0 comments

Comments

@SebastianWendorf
Copy link

SebastianWendorf commented Nov 23, 2023

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant