Thanks for responding, I'm currently doing #forceSaveOf: and it is working.
"This is the same as registering an object, but it tells us to disregard whether/how the object has changed and to save all of its fields. This is useful if we need to register an object after changes have occurred, and can be used to implement something more like an object by object save facility. Still somewhat experimental."
| realObject |
realObject := self realObjectFor: anObject ifNone: [^self].
self inUnitOfWorkDo: [currentUnitOfWork registerAsNew: realObject]
What I don't understand is why registering it as new still generates an UPDATE instead of an INSERT.
I know that objects read from the database are automatically registered, but since I do a lot of "read and if it doesn't exist then create it", and I treat both cases the same, so I do something like:
myPlayer := self readPlayerWithId: id ifNone: [self createNewPlayerWithId: id].
db register: myPlayer.
It is a simplified version of the code, but more or less it does the same for several objects that are sync'ed from an API.