The reason why I suggested this modification because the original code demonstrated another concept , not pc collision.
The original code tells us that an stateful bean with container managed transaction cannot run in a UserTransaction.
The output error message is actually:
javax.ejb.EJBException: java.lang.IllegalStateException: Bean is associated with a different unfinished transaction
Original code as Audit bean is stateless with transaction scoped PC and Department manager bean as stateful with extended PC.
Do not threaten THIS beaver! Not even with this tiny ad: