O'Reilly logo

Sams Teach Yourself J2EE™ in 21 Days by Peter Roxburgh, Andy Longshaw, Debbie Law, Dan Haywood, Martin Bond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extended Stateful Session Bean Lifecycle

Occasionally, there is a need for a stateful Session bean to have visibility as to the progress of the underlying transaction. Specifically, a bean might need to know

  • Has the transaction started?

  • Is the transaction about to complete?

  • Did the transaction complete successfully or was it rolled back?

For example, consider the age-old example of a ShoppingCart bean. In its purchase() method, it is likely to modify its internal state. Perhaps it holds its contents in a java.util.List called currentContents. On purchase(), it might move the contents of currentContents to another java.util.List called recentlyBought.

Suppose, then, that the transaction that actually modifies the persistent data store fails to complete. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required