• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

how many DAO's should be there in applciation.

Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was going over the DAO pattern example..Its about Movies.. so basically i have MovieDAO ,MovieDAOFactory ,MoviDAOImpl .. this 3 classes..so i f i have user registration in my app then there should be Registration DAO also .. right .. How may DAO's should be there in application .. is it like similar to the number of controllers in the applciation .. for ex. CartController,LoginController...and finally where should the database conncetion related logic should be ideally ..Inside the DAO implementation class or anywhere else..what should be the ideal scenario for Movie Rental application ..??how the sturcture should be ..
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-we usually create one DAO per our database table or view that we need , usually DAO are used to encapsulate data access in a seperate layer.

-there are some conditions that we have one DAO for more than one table , for example when you need to update multiple tables per operation.

-DAO is just for data access and Logic should not be pushed into DAO layer
business rules should be handled in business service entities .

-connections come from a resource manager , where ever in our DAOimpl that we need a connection we get the connection from resource manager and resource manager should know where to get connection from (a connection pool / using a singletone pattern and plain jdbc and driver manager ...)

take a look at http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
for more information
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic