Some transactions don’t propagate

The caller’s transaction might be suspended

If a transactional bean method calls another method, the called method (whether it’s in the same or a different bean) might not run in the same transaction. The called method, in that case, will run with either a brand new transaction, or with no transaction at all. (In a few minutes, we’ll look at how the container decides whether to propagate the transaction, run without one, or start a new one.)

  1. The first transaction is suspended and the second method runs without a transaction.

    image with no caption
  2. The first transaction is suspended and the second method runs within a new transaction.

    image with no caption

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.