JBoss.org Community Documentation

11.4.2. Entity Bean Lifecycle

With the default configuration of JBoss there is only one active instance of a given entity bean in memory at one time. This applies for every cache configuration and every type of commit-option. The lifecycle for this instance is different for every commit-option though.

  • For commit option A , this instance is cached and used between transactions.

  • For commit option B , this instance is cached and used between transactions, but is marked as dirty at the end of a transaction. This means that at the start of a new transaction ejbLoad must be called.

  • For commit option C , this instance is marked as dirty, released from the cache, and marked for passivation at the end of a transaction.

  • For commit option D , a background refresh thread periodically calls ejbLoad on stale beans within the cache. Otherwise, this option works in the same way as A .

When a bean is marked for passivation, the bean is placed in a passivation queue. Each entity bean container has a passivation thread that periodically passivates beans that have been placed in the passivation queue. A bean is pulled out of the passivation queue and reused if the application requests access to a bean of the same primary key.

On an exception or transaction rollback, the entity bean instance is thrown out of cache entirely. It is not put into the passivation queue and is not reused by an instance pool. Except for the passivation queue, there is no entity bean instance pooling.