• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dao pattern

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our design forum...
 
narender sunkam
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Maryam for responding
I have an doubt like how to implement dao pattern
can briefly explain me taking a small example
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic