posted 13 years ago
You are mixing the concepts of Transaction Boundaries (Container-managed or application-managed) and persistence context(which can be also container or application-managed).
UserTransaction.begin() and UserTransaction.commit() relates to Application-managed transaction boundaries.
EntityManager.joinTransaction() can be called when the entity manager instance has been created outside of an active transaction.
Have a look at the example 5.7.1.2 of the Persistence Specifications - it demonstrates exactly this situation.
HTH - Cheers