i BATIS is not an island unto itself—it is meant to be part of a whole. i BATIS can be
used in conjunction with any application that accesses a SQL database. Given that
there are a lot of different applications that may access a SQL database, we'll focus
on one popular type. Web applications are well known and usually access a SQL
database somewhere behind the scenes. To put i BATIS into a useful context, we
will walk through the creation of a shopping cart application. We tried to come up
with something original, so we decided to make it a game store rather than a pet
store. Let's move ahead with putting this application together.
14.1 Design concept
It's always good to begin writing an application with some sense of direction. A
good overview of what we want an application to accomplish is important.
Another term for this is requirements . Shopping carts are an easy concept to delin-
eate requirements for because they have been done many times. Tiresome as it
may be, we will do the same thing for this round. (Hey, at least it's not a pet store!)
We are going to keep the design of this shopping cart simple and focus our
efforts on the design of four major parts: the account, the catalog, the cart, and
the order. We'll forgo any management portions to the application, as those add
significant time and complexity to the requirements while adding little to the bot-
tom line of this topic. With the group of application components defined, let's
now provide some details on each of their requirements.
The account will house information relevant to a user. An account will contain per-
sonal address information and preferences. The user should be able to create and
edit an account. The account will also handle security for customer logins.
The catalog will house a significant number of the pieces we need to code. The cat-
egory , product, and item will be utilized here. The category, product, and item will
be only one level deep and will contain products. A product will then contain
items. Items are variations of the product. For example, a category named Action
would contain a game/product like Doom. The game/product would then con-
tain items like PC , PlayStation, XB ox, and similar variations.