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 filter ?

2 Answers   SolutionNET,


How to call the m1() method of Base class in below snippet ? class Base { public void m1() { System.out.println("Base m1 "); } public void m2() { System.out.println("Base m1 "); } } ====================== class Derived extends Base { public void m1() { System.out.println("Derived m1"); } public void m3() { System.out.println("Derived m3"); } public static void main(String[] args) { Base ob=new Derived(); ob.m1(); //System.out.println("Hello World!"+ob.m1()); } }

6 Answers   Cap Gemini, TCS,


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

0 Answers   CTS,


Which java collection class can be used to maintain the entries in the order in which they were last accessed?

0 Answers  


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 a constructor?

4 Answers  


What is the servletcontext listener and what is JspContext and page context pls tell in simple words.

1 Answers   IBM,


Q1. A. Write note on "The class path Environment Variable". B. Which are different kinds of source code? Q2. A. How to create an interface? B. Why convert an applet to an application? Q3. A. How to use Media tracker Class. B. How to use string tokenizer class. Q4. A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on "The properties class" Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites.

1 Answers  


whats the relation ship between LDAP and JNDI?

1 Answers  


Hi we have an urgent requirement for Java/J2ee technical lead position & also looking for "Java Guidewire claimcentre" experienced professional for Bangalore location if interested can reach srisanh@gmail.com

0 Answers  


Why do you use Context Object

2 Answers   HCL,


Explain JSP life cycle?

2 Answers   Accenture,


Categories