hm, but you need to somehow assign the generated uuid to the document if you need to generate it here.

i think i would pass in the document here and update it if you generated a uuid. the reason is that a document may be found in the executeUpdates through cascading, or a document itself may have changed metadata and now needs to get a uuid. by setting it here, we are sure that whenever we created a uuid, we also set it on the document if the document allows setting it.