aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes dao pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "dao pattern" Watch "dao pattern" New topic
Author

dao pattern

narender sunkam
Ranch Hand

Joined: May 01, 2004
Posts: 30
Hi ranchers,
I am very much confused with dao pattern
can any one explain me dao pattern with a simple example
I want some thing like discussion on this topic.


narender kumar
Maryam Nouhnejad
Ranch Hand

Joined: Oct 04, 2006
Posts: 39
It would be nice if you could write how much have you studied so far and what have made you confused in this subject...Anyway...

A typical DAO (Data Access Object) implementation has the following components:

�A DAO factory class
�A DAO interface
�A concrete class that implements the DAO interface
�Data transfer objects (sometimes called value objects)

You have to also know these assumptions behind the DAO implementation:

1 . All database access in the system is made through a DAO to achieve encapsulation.

2 . Each DAO instance is responsible for one primary domain object or entity. If a domain object has an independent lifecycle, it should

have its own DAO.

3 . The DAO is responsible for creations, reads (by primary key), updates, and deletions -- that is, CRUD -- on the domain object.

4 . The DAO may allow queries based on criteria other than the primary key. I refer to these as finder methods or finders. The return

value of a finder is normally a collection of the domain object for which the DAO is responsible.

5 . The DAO is not responsible for handling transactions, sessions, or connections. These are handled outside the DAO to achieve

flexibility.

So, which part of that do you intend to discuss with the others??...


Maryam
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Moving to our design forum...


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
narender sunkam
Ranch Hand

Joined: May 01, 2004
Posts: 30
Thanks Maryam for responding
I have an doubt like how to implement dao pattern
can briefly explain me taking a small example
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Google for "dao example". Study the examples and come back with more specific questions.

As an aside, I'd say that per default a DAO should return fully fledged domain objects, not DTOs. See http://www.martinfowler.com/bliki/LocalDTO.html


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Blueprints: DAO Pattern
Core J2EE Patterns: Data Access Object

Note that there are other database access patterns besides the J2EE DAO
Active Record
Table Data Gateway, Row Data Gateway, Data Mapper


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dao pattern
 
Similar Threads
why DAO?
EJB with DB Access
Design Patterns for DAO & VO
Preventing access of DAO layer from Service layer.
DAO Pattern