|
|
Data Access Object Pattern
|
Define
data access object pattern
|
Adapt a uniform interface to
access multiple databases like relational, unrelational,
object-oriented, etc.
|
Where
to use & benefits
|
Need to access multiple data
sources like legacy systems, B2B, LDAP, and so forth.
Lack of uniform APIs to address the requirements to access disparate
systems.
Persistent storage APIs vary depending on the product vendor.
Adapt and encapsulate all access to the data source.
Hide the data source implementation details from its clients.
More portable and less code dependencies in components.
Solve differences in the APIs which is used to access different
persistent storage mechanisms.
Not useful for container-managed persistence.
Related patterns include
- factory method -- used to deal with different data sources.
- abstract factory -- used to make an abstract layer of
access to data sources.
- transfer object -- used to transport data to and from its
clients.
|
Example
of Data access object pattern
|
See sun's code
sample
|
|
|