Appendix H. Transactions: Blackjack Game Example
All but the most simple of applications will have the requirement that a composite action, say, “Register a User,” succeeds or fails completely. In these cases, the single request is in fact a collection of many smaller pieces of work. If any of these smaller pieces fail halfway through the request, our application can be left in some inconsistent or error state. The use of transactions verifies that all compound actions comply with the ACID properties (atomicity, consistency, isolation, and durability). In other words, compound actions will either complete or fail as a single unit.
EJB offers declarative and programmatic support for transactions via
the Java EE
TransactionManager, and it comes
complete with annotations/XML to manage transactional boundaries.
Our example is a transactionally aware
poker service, showing the use of
Attribute and the various
Online Companion Information
Wiki article: http://community.jboss.org/docs/DOC-15573
Following is a full listing of all source code used in this runnable example.
package org.jboss.ejb3.examples.ch17.transactions.api; import java.math.BigDecimal; import org.jboss.ejb3.examples.ch17.transactions.entity.Account; /** * Defines the contract for a bank * * @author <a href="mailto:firstname.lastname@example.org">ALR</a> ...