What is need of DAO? Write one simple DAO example?

Answers were Sorted based on User's Feedback



What is need of DAO? Write one simple DAO example?..

Answer / naveen kumar v

DAO: Data Access Object. here the main concept of DAO is to
communicate with the database. DAO mainly contains
1.) DAOFactory: this specifies which kind of database
(wether MySQL or ORACLE or MSSQL etc...).

2.) SQLFactory: which extends the DAOFactory. Here we do
all the connection stuffs.deciding te driver, hostname,
URL, username, password etc and also getting the Connection
object.

3.) AdminDAO: this is a interface where we declare all the
methods which we need in our application to perform all the
database related operation.

4.) SQLAdminFactory: this implements the AdminDAO
interface, all its method. this also gets the connection
from SQLFactory.

5.) TransactionControlDAO: here we keep the commit and
roolback methods.

if required...
6) ConnectionConstant: in this file we can mention the file
name (.properties file) where we keep the connection
detals, like hostname, username, password, etc...

Is This Answer Correct ?    14 Yes 4 No

What is need of DAO? Write one simple DAO example?..

Answer / ankit

DAO(Data Access logic) provide the machanism to saperate our bussiness logic from data access logic and both code can be change independently that lead to flexibility in our application. and it also provide security because when will see spurce code from web page only the business logic can be seen and cant see the data access logic . and it also provide reusability

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More Java J2EE AllOther Interview Questions

what is class/object diagram

3 Answers   Zycus Infotech,


How to implement or use the singleton class in java?

3 Answers  


What are the queues in the java collection framework? : java collections

0 Answers  


what is difference between struts1.2 and struts2.0

1 Answers  


What is a constructor?

4 Answers  






In hyderabad, which s/w training center is best for java, other than corejava what r the new tools to learn in java,which tool is best & have current requirement,pls give me information about java to learn ?

0 Answers  


When to use the Collection Classes(HashSet, LinkedHashSet, TreeSet....etc) in real time scenario ?

1 Answers   Cap Gemini,


Hi Friends , am newbie to ajax. For example just consider one account registration - A form contains 8 text fields with submit button. In this form second texbox contains "username " . On right side of text box there is a label box . On clilck action i need to determine user is available or not. Is it possible on clicking label or should i click submit button.

0 Answers  


What is the Spring2.5 MVC Navigation flow?

1 Answers   IBM,


who will give req's to u?. how they send req's to u? . what design documents contains?. when bugs raised on other developer code how to report to them?.(throgh mail or ........). how to retrive 100 recods from dao layer to presentation layer.using which collection?. what is sequence diagram.?.

0 Answers   iGate,


What is the use of hashcode in java ?

0 Answers  


Hi frnds how to lock an user when he enter wrong credentials more than 3 time using java or j2ee tech take username and password in a bean no need to connect DB and validate give me some sample application code or links its urgent for me thanks in advance

0 Answers   NSN,


Categories