Represents the Extended persistence context injected into a stateful bean. At bean invocation time, will join the active JTA transaction if one is present. If no active JTA transaction is present, created/deleted/updated/loaded entities will remain associated with the entity manager until it is joined with a transaction (commit will save the changes, rollback will lose them).
At injection time, a instance of this class is associated with the SFSB. During a SFSB1 invocation, if a new SFSB2 is created with an XPC referencing the same persistence unit, the new SFSB2 will inherit the same persistence context from SFSB1. Both SFSB1 + SFSB2 will maintain a reference to the underlying persistence context, such that the underlying persistence context will be kept around until both SFSB1 + SFSB2 are destroyed. At cluster replication time or passivation, both SFSB1 + SFSB2 will be serialized consecutively and this instance will only be serialized once.
Note: Unlike TransactionScopedEntityManager, ExtendedEntityManager will directly be shared instead of the underlying EntityManager.
During serialization, A NotSerializableException will be thrown if the following conditions are not met: - The underlying persistence provider (entity manager) must be Serializable. - The entity classes in the extended persistence context must also be Serializable.
@author Scott Marlow