Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:00:32+00:00 2026-06-12T17:00:32+00:00

Normally, I try to structure my DAO classes in such a way that they

  • 0

Normally, I try to structure my DAO classes in such a way that they are completely dependent on themselves. They can interact with multiple tables but only if the data relates to the base object. For example, say I have an appointment object and the appointment DAO pulls data from an appointments table. Lets say one column if the appointments table is a service id which is a foreign key that binds an appointment to a service. The services table is completely independent of the appointments and has its own DAO where the user can add or remove services.

The appointment object has a service field which is meant to store a service object. I did this because in many circumstances in the view its necessary to reference this service object when dealing with the appointment.

In the appointment DAO I could write separate SQL statements to pull the service data from its table and remap all of this in the appointment DAO, but all of this is already being done in the service DAO and would be as simple as calling serviceDao.find(serviceId). I feel a little dirty referencing the service DAO inside my appointment DAO. Is this because I’ve got design problems or is it OK to do this sort of thing? I’ve tried researching this problem and the results are 50/50.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:00:33+00:00Added an answer on June 12, 2026 at 5:00 pm

    Why is having one service DAO refer to another so bad?

    The one concern you need to watch for is death by latency. If your service DAO brings back N instances, and you then loop over those results to bring back other stuff, then you’ll have N+1 queries – and N+1 network roundtrips – where a single roundtrip with one JOIN would bring all that data back at once.

    I’d recommend that you worry less about the DAOs and more about writing the best, most efficient SQL you can.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Normally, I'd do this: try { code code that might throw an anticipated exception
Question: Normally, you can undo a sql command with rollback. BEGIN TRY BEGIN TRANSACTION
I use TortoiseSVN normally and it works fine. Whenever I try to use SVN
Normally, if I want to start a new activity I can use StartActivity(typeof(foo)); This
Normally we use window.location.href=/index.php?querystring; in javascript. Is there a way to send the querystring
I am coding in javascript & I need HashMap type structure . Normally when
When you try to do things using Windows Batch, you normally think on a
i am try to parse string to date it works normally well but when
I'm giving up my search, I normally try to figure these things out on
I understand how to call a callback normally, but when I try to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.