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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of ways where you can iterate over a list? : java collections

656


What do you understand by synchronization? Why is it important?

676


What are the main classes of the list interfaces? : java collections

675


Which sorting algorithm is used by collections.sort() in java ?

629


What is the Spring2.5 MVC Navigation flow?

5539






What are maps interfaces in the java collections? : java collections

663


What are the uses of the set interfaces in the java collections? : java collections

632


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

697


What are the differences between the java collection and the java list? : java collections

699


What is the use of hashcode in java ?

670


what is mean by hasing and maping in java platform and advantage?

1941


can u draw class/object diagram for ATM

5657


my interviewer asked me what technical specification you used how to answer that question

2026


What is deque in the java collections framework? : java collections

614


What are the different types of collections views being provided by the map interface? : java collections

689