Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Testing an EntityManager that uses the default, PersistenceContextType.TRANSACTION, can be challenging due to Entities detaching around transaction boundaries. If you were to take the Injection of EntityManager Example which uses an EXTENDED persistence context and switch it to a TRANSACTION persistence context making no other changes, you'd find that the test would fail. This would be because of the detach.

...