• 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

how many DAO's should be there in applciation.

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ..
 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
hth
 
grapes are vegan food pellets. Eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic