When evaluating an expression, each script engine (at least juel and groovy) creates its own variables, e.g. a context and a printer, but doesn't remove them.
The default write-context in ScriptManager configuration is the execution context. So when the variables are created, they are UnpersistableVariables and an hibernate exception occurs when the transaction ends.
This problem doesn't appear in non persisted mode or if there is no write-context.
Do you see how this could be solved?
scripting evaluation ends, make the default so that no variables get propagated from the scripting engine to the process variable context after.