RowIds are not stable if the are generated by the DB. I used sessions for an staging area. So I was reverting them, then applied the external changes and applied the reverted once again. If the external changes were semantically the same as my changes it could not work because the primary key was a rowid. The primary key had to be a key which is the same for the external changes and my changes.