Chapter 4. Databases and JBoss
Up to this point, this book has focused on the web tier. Now let’s look at the persistence tier. This is where the application data is stored for the long term—for example, between server restarts.
Why use the phrase “persistence tier” instead of simply calling it the “database tier”? We certainly recognize that the probability of information ending up in a database approaches is somewhere close to 100%. J2EE pundits love pointing out that data could be stored in any number of manners—as flat files, XML, and even web services to remote servers. These types of storage are mentioned as alternatives, but we have yet to work on an application where they completely usurp the trusty database.
Instead, most modern persistence technologies deal with transforming relational database information into Java objects. These Object/Relational Mappers (ORMs) come in many flavors—commercial and open source—but make the same promise: to free the Java developer from the perils of converting ResultSets to ArrayLists of DTOs.
We continue to use the phrase “persistence tier” to remind us that many supporting services surround the inevitable database.
Persistence Options
You should acknowledge one simple fact up front: if you deal with
a relational database, all roads in one form or another lead to JDBC.
Whether you write the code yourself or let an ORM write it for you, SQL
INSERTs, UPDATEs, and DELETEs are the lingua franca of any
database-driven application.
While Sun maintains ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access