Hi Rachel,
took me some time to look deeper into your issue but finally I did it. Here are some explanations:
2) When run as a unit test, each node only prints its name once, and the test passes.
This is due to not enough time for job executors to finish their job, I mean that your main thread (junit) will kill all child threads as soon it will go through the loop. Just put a sleep on your main class and you should get all print outs from your custom nodes.
1) When run as a Java application , the following exception is thrown:
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.pvm.internal.model.ExecutionImpl#7]
I could reproduce that only when I manually executed job at the same time job executors were running. Moreover, I did deploy it to db and then run it from console and it worked fine. Did you try to run it from console?!
HTH
Maciej