DEVFYI - Developer Resource - FYI

What is Data Access Object pattern?

Java Interview Questions and Answers (part 3)

(Continued from previous question...)

418. What is Data Access Object pattern?

The Data Access Object (or DAO) pattern:
separates a data resource's client interface from its data access mechanisms
adapts a specific data resource's access API to a generic client interface
The DAO pattern allows data access mechanisms to change independently of the code that uses the data.
The DAO implements the access mechanism required to work with the data source. The data source could be a persistent store like an RDBMS, an external service like a B2B exchange, a repository like an LDAP database, or a business service accessed via CORBA Internet Inter-ORB Protocol (IIOP) or low-level sockets. The business component that relies on the DAO uses the simpler interface exposed by the DAO for its clients. The DAO completely hides the data source implementation details from its clients. Because the interface exposed by the DAO to clients does not change when the underlying data source implementation changes, this pattern allows the DAO to adapt to different storage schemes without affecting its clients or business components. Essentially, the DAO acts as an adapter between the component and the data source.

(Continued on next question...)

Other Interview Questions