채문영
채문영

Reputation: 1

Spring Data Neo4j Composition

I want to implement using a class as composition.

For example:

public class Person {
  String name;
  Integer age;
}

@Node("Student")
public class Student {
  Person person;
  String school;
}

@Node("Manager")
public class Manager {
  Person person;
  String job;
}

Given the code above, I would like the Student node to have school and properties of Person (name, age).

I’ve seen @CompositeProperty, but since it requires using a Map, it’s different from what I want to achieve. This could be represented with an IS-A relationship, but that might make the relationships more complex. Instead, I want to store them as properties. Is there a way to implement this?

Upvotes: 0

Views: 32

Answers (0)

Related Questions