What is the DAO design pattern

Questions by prasannaramudu

Showing Answers 1 - 18 of 18 Answers

durgak_javaprof

  • Nov 22nd, 2007
 

It abstracts the data base access from Java application and makes it portable and dbms independent.

This helps to move to a different RDBMS at any point of time with less amount of changes in Java code

yathirajulu

  • Sep 30th, 2008
 

It is a main role on server-side application, and easily to access RDBMS and consume the time & cost, reduce the burden on developers. Moreover it is platform indepedent.

  Was this answer useful?  Yes

DAO design pattern is all about providing a unique interface to access data from EIS.
It abstracts the low level data accessing constructs of DB specific and provides an interface hense we can still access data by doing a very less changes in our application when the DB is changed.

DAO design pattern helps to hide the complex database access, and provides the developer the freedom from it. It can be used for single DB or multiple DB based on the design pattern it is implementd. If the DB of the underlying system is not subjected to change Factory pattern can be used but if the underlying DB is changing or there are multiple DB than the Abstract Factory pattern can be used. 

  Was this answer useful?  Yes

Generally in the previous projects they write the code for controller's and code for interacting with database like inserting,
updating, deleting etc...will be done at one place.  But if you see the now a days frameworks they try to
separate each layer like for displaying one layer, for controlling one layer and for persting the data into database another layer is used.  I will explain
you with a simple example.  Consider one web-application when the user enters the data then that data is taken in
JSP's and it is transferred to the controller now the controller checks which java class is suitable for this particular operation here the operational code is placed in DAO layer so the controller finds correct class in DAO layer and send the user entered information to the particular class. In DAO layer we have already written the code for interacting with database and the response is send back the
JSP's via controller's.

I think you ask one question like what is the purpose of
separating them.  Here answer is in future when the project comes into
maintenance.  If any bug occurs then first they checks where the problem
has arisen for example the error is occurred in DAO layer then it is easy for them to find the problem.  If we don't use the DAO layer as a
separate the u have to waste lot to time to find where the problem is occurred

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions