Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-30-2018 09:01 AM
Hi,
I have been struggling for a while to use the ogm-driver to load relationships of collections of child classes.
@Relationship(type = "HAS_INGREDIENT")
Set<Ingredient> ingredients;
When instantiated to contain some objects that inherit from Ingredient, those child objects relationships won't load.
@NodeEntity
public class Strawberry extends Ingredient {
@Relationship(type = "TASTES_LIKE")
Flavor flavor;
}
public class Ice extends Ingredient {
@Relationship(type = "HAS_TEMPERATURE")
Temperature temperature;
}
The properties and labels of the Ice/Strawberry nodes load just fine from the graph, but not their relationships. Is there a way to make this work?
Example project:
05-14-2020 03:37 PM
I have this exact same use case. Any updates?
06-07-2020 04:43 AM
I think this is related to the general problem of inheritance.You can't use base type to model all relationship in inheritance hierarchy.You can include them in a Set but if you want to invoke a specific relationship you need to invoke language features like instanceof and then map it to specific type.
All the sessions of the conference are now available online