This section describes how to code a very simple session bean. When you have completed the steps in this section, you will have a jar file that is ready for deployment. See Deploying enterprise beans for a description of the deployment process and the tools available to help you.
The example bean shown here simulates a roulette wheel in a casino. The roulette wheel is a stateful session bean, containing two stateful fields. The first field is the current number that the wheel is on; the second field is the amount of credit the gambler still has for betting. The client creates a roulette wheel, optionally specifying the amount of money to gamble (defaulting to 100 dollars if the amount is not supplied). The client can place bets on the color that will come up and then the wheel spins and tells the caller if he has won or not. The client may then collect the winnings or continue betting.