simonl
simonl

Reputation: 1240

SDN4 - MappingException thrown when using an interface as the end of a RelationshipEntity

This functionality was working at one point but seems to have broken in the latest SDN4 snapshot (7-16-15)

I have two node classes, one representing intermediate, non-leaf nodes and one representing leaf vertex nodes of degree one. The two classes implement a common interface.

public interface Node {
    ...
}

@NodeEntity
public class SimpleNode implements Node {
    ...
}

@NodeEntity
public class SimpleLeafNode implements Node {
    ...
}

The former can be related to other intermediate nodes OR leaf nodes and I have modeled this relationship by mapping the SimpleNode class to the Node INTERFACE:

@RelationshipEntity
public class SimpleRelationship {

    @StartNode
    private SimpleNode parent;

    @EndNode
    private Node child;
}

When I try to start up my Spring Boot application, I receive an SDN mapping exception:

Caused by:
    10:51:04.173 [DEBUG] org.neo4j.ogm.metadata.MappingException: No identity field found for class: com.sdn4demo.entity.Node
    10:51:04.174 [DEBUG]    at org.neo4j.ogm.metadata.info.ClassInfo.identityField(ClassInfo.java:291)
    10:51:04.174 [DEBUG]    at org.springframework.data.neo4j.mapping.Neo4jPersistentProperty.<init>(Neo4jPersistentProperty.java:76)
    10:51:04.174 [DEBUG]    at org.springframework.data.neo4j.mapping.Neo4jMappingContext.createPersistentProperty(Neo4jMappingContext.java:100)

Again, this was working before the 7-16-15 snapshot so my questions is - is this not supported functionality? Is this a bug?

A contrived example exists at: https://github.com/simon-lam/sdn-4-demo

Reproduce-able by doing ./gradlew clean test --debug

Upvotes: 3

Views: 679

Answers (1)

ATG
ATG

Reputation: 1707

It's a bug. We're currently working on sorting stuff out regarding SD-commons and Spring DATA REST integration and this is one of those consequences of using the bleeding edge stuff.

Using RC1 is probably the best bet for now. Keep an eye on this JIRA issue to see when it's completed: https://jira.spring.io/browse/DATAGRAPH-564

Upvotes: 3

Related Questions