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
Describe the bug
The error occurs when inserting an entity that has an interleaved relationship with another table, and at least one shared primary key is null.
@Table
public class Parent {
@PrimaryKey
@Column
private String keyOne;
@PrimaryKey(keyOrder = 2)
@Column
private Long keyTwo;
@Interleaved
private List<Child> children;
// More fields
}
@Table
public class Child {
@PrimaryKey
@Column
private String keyOne;
@PrimaryKey(keyOrder = 2)
@Column
private Long keyTwo;
@PrimaryKey(keyOrder = 3)
@Column
private Long keyThree;
// More fields
}
var keyOne = "keyOne";
var keyTwo = null;
var keyThree = "keyThree";
List<Child> children = List.of(new Child(keyOne, keyTwo, keyThree));
Parent parent = new Parent(keyOne, keyTwo, children);
parentRepository.save(parent) // extends SpannerRepository
Error:
Cannot invoke "Object.equals(Object)" because the return value of "java.util.Iterator.next()" is null
The text was updated successfully, but these errors were encountered:
agustintabarez
changed the title
Spanner - PK fields which can be null - Save entity with @Interleaved field - NPE
Spanner - PK fields which can be null - Save entity with @Interleaved field
Feb 20, 2024
Describe the bug
The error occurs when inserting an entity that has an interleaved relationship with another table, and at least one shared primary key is null.
Versions:
spring-cloud-gcp-dependencies: 5.0.3
spring-boot: 3.2.2
Sample
Error:
Cannot invoke "Object.equals(Object)" because the return value of "java.util.Iterator.next()" is null
The text was updated successfully, but these errors were encountered: