-
Notifications
You must be signed in to change notification settings - Fork 618
Closed
Labels
status: feedback-providedFeedback has been providedFeedback has been provided
Milestone
Description
SDN 6.2.4 may instantiate the wrong type of node under certain circumstances.
I have an example repo but here is a summary of the problem.
For example, say you have this weird type hierarchy
@Node
public abstract class Animal {
}
@Node
public interface Cat {
}
// No Node annotation!
public class DomesticCat extends Animal implements Cat {
}
@Node
public class Tiger extends Animal implements Cat {
}
If you save and query for a Tiger
, then save and query for a DomesticCat
, the second node will be a Tiger
instead
Tiger tiger = new tiger();
animalRepository.save(tiger);
Tiger found1 = (Tiger) animalRepository.findById(tiger.getId()).get();
DomesticCat cat = new DomesticCat();
animalRepository.save(cat);
// ClassCastException: found2 is a Tiger
DomesticCat found2 = (DomesticCat) animalRepository.findById(cat.getId()).get();
If you add @Node
to DomesticCat
or save and query in a different order, there are no errors.
This example worked correctly in SDN 6.2.1 but it fails with SDN 6.2.4.
Metadata
Metadata
Assignees
Labels
status: feedback-providedFeedback has been providedFeedback has been provided