The example application is a web-based application, and the first choice we have to make is what application server to target. Although most J2EE servers provide compatible implementations, the deployment steps and configurations vary between them. The original implementation of this sample application used an EJB container, which we now consider unnecessary for this type of application. Back in 2001, EJBs provided the only available solution for declarative transactions in Java/J2EE applications, and this was the motivation behind implementing parts of the application as EJBs. Spring's transaction framework now provides an attractive alternative solution, so we have chosen not to use EJBs. This not only simplifies the code we will need to write but gives us more options when it comes to picking an application server.
We think that the Apache Tomcat server provides a good starting point for our sample application. It is widely used, so you may well be familiar with it already, and it provides a stable environment for development and for production use.
Next up is the choice of a database server. We primarily used MySQL 4.1 to develop this sample application, but the code should work against other SQL databases. We have tested the application on PostgreSQL 8.0 and Oracle 9i/10g and we provide database scripts for these databases as well. You will not be able to use older MySQL versions, however, because we make use of sub-queries, which were not supported in version 4.0 or earlier.
In the rest of this chapter we will look at the completed application starting with the database layer and working our way up via the DAO layer, to the Service layer, and finishing with the Web layer.