This is sort of heavy handed but can you call entityManager.clear() first to detach the entity? This will detach ALL entities from your pc. Unfortunately clear() is not overloaded to take a particular class or object :(
By default, the persistence context is going to be flushed after every transaction but if you are using an SMPC you can use specify flush mode as manual when beginning your conversation. This allows you to control when your entities are flushed to the DB. This is described in the documentation at:
Thanks to you two.
I was pondering to fall back to hibernate specific api to be able to call evict() for a single entity instance.
Probably the suggestion Jacob made is cleaner. I just have to learn and understand where and how to start/end my conversation.
For now I have a third solution working: I marked my Test button as immediate="false" and for both the script field and the test value input field I used binding attribute to be able to get the submitted value directly from the component.
Then I do
to skip the remaining phases.