SDN is unable to instantiate nodes with multiple levels of
inheritance and a non-empty @DynamicLabels
field.
For example, say you have a super class
@Getter
@Node
public abstract class Animal {
@DynamicLabels
private Set<String> labels = new TreeSet<>();
}
A sub class
@Node
public abstract class Feline extends Animal {
}
And a sub class of the sub class
@Node
public class Cat extends Feline {
}
You can query for instances of the Cat
sub class only if they do not have a dynamic label
Cat cat1 = new Cat();
animalRepository.save(cat1);
Cat cat2 = new Cat();
cat2.getLabels().add("Orange");
animalRepository.save(cat2);
Cat found1 = (Cat) animalRepository.findById(cat1.getId()).get(); // this is fine
Cat found2 = (Cat) animalRepository.findById(cat2.getId()).get(); // BeanInstantiationException
The second query fails if the Feline
sub class is abstract or concrete, though the exception is different.
This example worked correctly in SDN 6.2.1 but it fails with SDN 6.2.4.
Don't forget to set database credentials in application.properties.
Run tests via mvn clean install
or via an IDE.