Because all of these bid-related functions are simple, single-step processes, a stateless ses-
sion bean can be used to model all of them. The DefaultBidService presented in list-
ing 3.1 contains methods for adding, viewing, and cancelling bids. This is essentially an
enhanced version of the basic PlaceBid EJB you saw earlier. The complete code is avail-
able for download from http://code.google.com/p/action-bazaar/ .
We're using JDBC for simplicity because we haven't introduced JPA in any detail yet. We
don't want to assume that you already understand ORM. Using JDBC also demonstrates
dependency injection of resources and the stateless bean lifecycle callbacks. In general, you
should avoid using JDBC once you're comfortable with JPA.
Listing 3.1. Stateless session bean example