Sun GlassFish Enterprise Server v2.1.1 Developer's Guide

Extended Persistence Context Failover

A reference to an extended persistence context in a stateful session bean or an HttpSession may not fail over successfully.

The Java Persistence API specification is not clear how the container and persistence provider should work together to passivate a stateful session bean with an extended persistence context in a stand-alone server instance. This also prevents successful serialization and storage of a reference to an extended persistence context in an HttpSession.

Even in a single-instance environment, if a stateful session bean is passivated, its extended persistence context could be lost when the stateful session bean is activated. In this environment, it is safe to store an extended persistence context in a stateful session bean only if you can safely disable stateful session bean passivation altogether. This is possible, but trade-offs in memory utilization must be carefully examined before choosing this option.

In a single-instance environment, it is safe to store a reference to an extended persistence context in an HttpSession.