Hey,
I have a very complex sync logic where something goes wrong.
I have two kind of objects that I persist using TWIG:
- Task
- TimeRegistration
The TimeRegistration object has a reference to a Task.
So what I do first: create some tasks in the database, for example Task A and Task B
Then I create a new TimeRegistration in the database linked to Task A. So far so good.
But then it should be possible to link the time registration to a different project. So I change that time registration to be linked to Task B.
I do change the task to Task B. I persist. After the transaction commits I can retrieve the time registration and if I check the task it is Task B.
But then in a new http-request I execute a new sync process. At a certain time I read the same TimeRegistration again and check it's task and it seems to be Task A.
Weird huh...?!
Together with changing the task on TimeRegistration I also change a date-field. In the checks I do after the update the date-field is always correct.
Ever more weird, huh... ?!
I don't get it, but for some reason the relation is not updated...
This is the mapping:
@Entity(kind="timeRegistration")
public class TimeRegistration {
@GaeKey private Key key;
@Index private Date startTime;
@Index private Date endTime;
private String comment;
private String flags;
@Activate @Parent private Task task;
// Getters and setters...
}
@Entity(kind="task")
public class Task implements Cloneable {
@GaeKey private Key key;
// Some other fields
// Getters and setters...
}