Chapter 10. Persistence

Nearly every J2EE application needs to access persistent data. Most enterprise applications need to or choose to work with relational databases, which represent an established and well-understood paradigm for keeping persistent data.

This is not to disparage object databases, which can provide real benefits to many applications written in object-oriented languages. However, object databases have failed to make significant headway in the market, and are not an option in most projects. This is disappointing from a technical perspective, but unfortunately technical decisions usually need to be made within political constraints.

Bridging the gap between OO application code and RDBMS concepts can be tricky. Hence data access can account for much of the code in typical J2EE web applications, and much of the complexity and developer effort. Determining an appropriate data access strategy can be difficult, as there are many competing paradigms and solutions. It?s crucial to get this decision right, as naïve or otherwise unsatisfactory approaches to data access can doom applications to failure: mired in complexity, performing poorly, or failing to scale.

This chapter focuses on practical ways for accessing relational databases from lightweight J2EE applications. We will discuss basic differences between the major strategies and usage scenarios. We will also address an often neglected issue: the implications of each data access strategy for the overall application ...

Get Expert One-on-One™ J2EE™ Development without EJB™ now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.