Details
-
Task
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
None
-
Platform Sprint 140
Description
Regarding the usages of the update() and save() methods of the WorkflowPersistanceManager we have a best practice. An example online reflects this (1), but I think it should be clear from the javadoc as well.
1.) https://www.onehippo.org/library/concepts/rest/restful-jax-rs-component-support-in-hst-2.html
Although it is at the moment technically not necessary to call WPM.save() after a call to WPM.update(), it is actually recommended. Please check if there are more methods in this class that can reflect a best practice.
More background in a comment from wko:
- At the moment, wpm.update() is actually saving the intermediate changes before invoking wpm.save(), which is not that correct semantically. However, it had to be done that way due to our Hippo workflow designs (and limitations). Hippo workflow API doesn't provide "all-or-nothing" semantics. If you fail to save something through Hippo workflow in the final step, it leaves an intermediate garbage states as a result. Therefore, we had to accept that limitation by invoking session.save() even in the intermediate #update() call (which is semantically meaning intermediate updates before committing).
- However, I and Ard agreed that we need to keep wpm.save() separately and recommend people to use the call after wpm.update() because a) it's semantically more correct and b) in the future, we may improve Hippo Workflow internal API to support all-or-nothing transactional mechanism.