Building the Storefront Model
After all this discussion of what constitutes a model for a Struts application, it’s finally time to apply the previously discussed concepts using the Storefront application as the business domain. Obviously, the Storefront is a fictitious example and doesn’t represent a complete model for what a “real” e-commerce application would need to support. However, it does provide enough of an object model for you to understand the semantics of this chapter.
Accessing a Relational Database
The state of the Storefront application will be persisted using a relational database. This is, in fact, how it would be done if Storefront were a real application. Of course, an ERP system often is used in conjunction with the relational database, but many e-commerce applications use a relational database closer to the frontend for performance and ease of development. When both are deployed in an enterprise, there’s usually a middleware service to keep the data between the two synchronized, either in real time or using batch mode.
As you probably are aware, there are many relational databases to choose from. You can choose one of several major database vendors or, if your requirements don’t call for such a large and expensive implementation, you can choose one of the cheaper or free products on the market. Because we will not be building out every aspect of the application and our intended user load is small, our requirements for a database are not very stringent. That said, ...