Inherited properties of related entities are not visible in spring-data-neo4j-rest

127 views Asked by At

I have three NodeEntities A, B, and C. A is the parent of B and C. C has a property of type Set. For all three entities I have also a PagingAndSortingRepository. The Spring Boot application is set up as in the example https://spring.io/guides/gs/accessing-neo4j-data-rest/. Now there is a strange thing: If I browse the B-repository directly using the url localhost:8080/B I see all the parent properties that B inherits from A. But if I browse the Bs over C, like localhost:8080/C/0/B I see the Bs but all the inherited properties are empty. Is this a bug or is there something missing?

1

There are 1 answers

0
Michael Hunger On BEST ANSWER

Do you have a sample project that reproduces this? Or at least share the code for the classes.

Could be that your B relationship needs to have a @Fetch annotation to be fully hydrated for the load.

Update

As I presumed, the transitive child is not loaded automatically, so if you really need the data there, then add the @Fetch annotation.

public class Composite extends Component {
    @Fetch
    private Set<Leaf> leaf;
....    
}