You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the below setup, I get an error when I try to call the saveAll method to save multiple different subtypes of the same parent.
@Node
public abstract class Step {
//some properties
@Node
public static class Chain extends Step {
//some properties
}
@Node
public static class End extends Step {
//some properties
}
@Node
public static class Origin extends Step {
//some properties
}
}
public interface StepRepository extends Neo4jRepository<Step, String> {
}
public class SomeService() {
someMethod() {
List<Step> steps = List.of(new Origin(), new Chain(), new End());
stepRepository.saveAll(steps);
}
}
Error details: java.lang.IllegalArgumentException: Type must not be null!
In Neo4jTemplate - Class<T> domainClass = (Class<T>) CollectionUtils.findCommonElementType(entities); is returning null because CollectionUtils.findCommonElementType is counting the sub types as different class types.
Spring Boot: 2.4.5
Spring Data Neo4j: 6.0.8
The text was updated successfully, but these errors were encountered:
michael-simons
changed the title
Unable to use saveAll to save multiple subtypes
Fix detection of common element types in collections of persistent entities.
Apr 30, 2021
Given the below setup, I get an error when I try to call the saveAll method to save multiple different subtypes of the same parent.
Error details:
java.lang.IllegalArgumentException: Type must not be null!
In Neo4jTemplate -
Class<T> domainClass = (Class<T>) CollectionUtils.findCommonElementType(entities);
is returning null becauseCollectionUtils.findCommonElementType
is counting the sub types as different class types.Spring Boot: 2.4.5
Spring Data Neo4j: 6.0.8
The text was updated successfully, but these errors were encountered: