Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
From the previous chapters, you know that one of Spring’s goals is to allow you to develop applications following the sound object-oriented (OO) principle of coding to interfaces. Spring’s data access support is no exception.
DAO[1] stands for data access object, which perfectly describes a DAO’s role in an application. DAOs exist to provide a means to read and write data to the database. They should expose this functionality through an interface by which the rest of the application will access them. Figure 5.1 shows the proper approach to designing your data access tier.
[1] Many developers, including Martin Fowler, refer to the persistence objects of an application as repositories. Though I appreciate the thinking that leads to the repository moniker, I believe that the word repository is already overloaded, even without adding this additional meaning. So forgive me, but I’m going to buck the popular trend—I’ll continue referring to these objects as DAOs.