WebSphere® Application Server provides some ActivitySession samples.
The servlet begins an HttpSession at the start of each new game, and ends it at the end of each game; therefore an ActivitySession lasts for the duration of each game. The ActivitySession activation policy stops the bean from being passivated and therefore the transient data remains in memory. This sample demonstrates the association between HttpSession and ActivationSession in the web container, and an ActivitySession-scoped activation policy.
The entity bean also holds a transient variable that each method call increments (gets and sets for the persistent data). This value is checked before the end of the ActivitySession to show that the same bean instance is used. The client checks for the correct results.
Both beans are configured with TX_NOTSUPPORTED.
The sample checks for correct results and reports them back to the client.