Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DAO ?

 
Vishakha Ahuja
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB Objective:
"Identify costs and benefits of using an intermediate data-access object between an entity bean and the data resource"
What are DAO's and how do we make use of them ?
 
Amanda Waite
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
DAO's are Data Access Objects. In an EJB application you'll use them to do the actual work of fetching data from the EIS tier when using BMP. You can then deploy/use different DAO's for different databases without having to change the entitiy beans.
You can use DAO's anywhere where an application has to make calls to a database. It allows you to separate the database code from the Business logic.
Amanda
 
Vishakha Ahuja
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Amanda. I understood the use. Now to code DAO, do we use regular java class or do we subclass any specific class ? And are they the part of JAR file that contains the enterprise beans ?
 
Vivek Viswanathan
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to get more information about DAO in the J2EE blueprints, and also in the petstore application to see the implementation code. I think the J2ee Design patters, also explains about DAO.
Amanda, is there any more information that I can get about DAO, other than the above mentioned sources ??
And do I have to know anything about Microsoft's Implementation of DAO ???

Thanx
Vivek
 
Amanda Waite
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The pattern is described in detail at: http://developer.java.sun.com/developer/restricted/patterns/DataAccessObject.html
It also describes how to make best use of the DAO by using the abstract factory and factory method patterns to create the right bean for the right persistent store.
Amanda
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic