I have two objects one parent model have ToOne
relation and a child model with ToMany
relation back to the parent. Now if I have two parents who are setting their relation to child then the first parent's reference to child is getting null when the second parent reference is set. Also, if I remove the id field from the child then both parents child is stored in the database.
Suppose I have a class like
Student{
String id;
final teacher = ToOne<Teacher>();
}
and another class Teacher as
Teacher{
@Unique(onConflict: ConflictStrategy.replace)
String? id;
@Backlink()
final students = ToMany<Student>();
}
so now if I try to do something like
student1.teacher.target = teacher1
followed by
student2.teacher.target = teacher1
then if I try to check for student1 then its teacher is getting null. Why ?