Application Architecture

Application Architecture
Note: The above figure shows the application architecture using hibernate. A application consist of user interface layer, Application interface layer, DAO layer that manage the connection with the data source to obtain and store data. DAO use hibernate to connect with the database that covert into JDBC internally, then JDBC connect the application to the database. 
		

DAO [Data Access Object]

  • Use DAO to separate Object-Relationship behavior from the rest of your project as it provide high level of data source abstraction.
  • The DAO manages the connection with the data source to obtain and store data, data could be a persistence object.
  • DAO make application data source independent that is DAO hides the underlying data source implementation from its clients.
  • DAO interface to clients doesn't change when the underlying data source implementation changes.
Suppose you have three DAO classes that create, select, update or delete [CRUD] operation into database and each DAO class has four methods for CRUD operation.

EmployDAO
StudentDAO
CourseDAO
find(String) : Employ

save(Employ) : boolean

update(Employ): boolean

delete(Employ): boolean
find(String) : Student

save(Student) : boolean

update(Student): boolean

delete(Student): boolean
find(String) : Course

save(Course) : boolean

update(Course): boolean

delete(Course): boolean

Note: The above classes has redundant code to perform CRUD operation into database. To fix this situation the concept of AbstractDAO comes in picture.

Hibernate Abstract DAO

AbstractDAO
AbstractDAO is a super class of all other DAO that contains methods for CRUD operation, which are common to all sub DAO that is all DAO need these method to perform CRUD operation into database, So to remove redundant data from the code abstarctDAO is created this pattern is called Superclass pattern.