Enterprise Java Development@TOPIC@
Interfaces to data sources vary
Relational Database Management Systems (RDBMS)
NoSQL Solutions
Flat Files
Backend Systems
Even standard RDBMS/SQL interfaces can vary
Many components within application need access to data
Interfaces to data vary by technology and vendor
Least common denominator option for portability may not be feasible in all cases
May make use of vendor extensions
Impact of unique interfaces significant when exposed to many components and component types
Components need more abstraction and shielding from the details of the persistent store
Use a Data Access Object (DAO) to abstract and encapsulate access to business objects in the data source
Business Logic
Object within the business domain that needs access to data (e.g., session bean)
Knows when/why data is needed, but not where or how to access it
Data Access Object
Abstracts the access details from the business object
Knows where/how data is accessed, but not when or why to access it
Business Object (Entity)
An entity within the business logic
Encapsulates information and data business rules within application
A data carrier of information to/from the DAO
Data Source
Physically stores the data (e.g., database)
Key point: hide details from business logic and other interfacing components
Centralizes All Data Access into a Separate Layer
Easier to maintain
Enables Transparency
Access to implementation details hidden within DAO
Enables Easier Migration
Client layers encapsulated from changes
Reduces Code Complexity in Business Logic
No details, such as SQL, in business logic
Was hard to abstract with EJB 2.x Container Managed Persistence (CMP) frameworks
EJB3 Java Persistence API provides a significant amount of abstraction