When an item is saved (either through Item.save or Session.save) the item in persistent storage to which pending changes are written is determined using the same principles as those that govern correspondence of nodes between workspaces (see 4.10.2 Multiple Workspaces and Corresponding Nodes). The difference in this case is that the correspondence is not between two workspaces but between the transient storage of the session and the persistent storage of its associated workspace. In the context of saving a node, those principles amount to the following:
If the transient item has a UUID, then the changes are written to the persistent item with the same UUID.
If the transient item does not have a UUID, then a combination of the UUID of its nearest UUID-bearing ancestor and its relative path from that ancestor is used to determine the persistent item to which the changes will be written. For example, if
node /a/b/c and node /a/b do not have UUIDs;
node /a has UUID u;
then, pending changes to transient node /a/b/c are written to the persistent node located at path b/c relative to the persistent node with UUID u.