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 3607768
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:25:04+00:00 2026-05-18T21:25:04+00:00

Consider the following situation. I have 3 tables in a resource planning project(created using

  • 0

Consider the following situation. I have 3 tables in a resource planning project(created using mysql)

  1. raw_materials (stores details about all raw materials)

  2. procurement_orders (stores details about all details about requests sent to vendors for sending us the quotations. This table references the raw_materials table.)

  3. quotations (contains details about all quotations sent by vendors to us. This table references the procurement_orders table).

I have created dbManagers for each of them using java which specialize in storing,retrieving,deleting data from respective tables.

My question is if i want to retrieve data which has to needs data from other tables, what is the best way to do it. eg:I want quotations of all raw_materials having stock below x. then according to me there are two ways

  1. i write it in dbManager for rawMaterials. The flaw with this technique is it tries to access data out of its domain directly.
  2. in dbManager of of raw_Materials create instances of other dbManagers. The flaw here is the iterations will large. As in if there are 300 raw materials, i will have to call method of the procurement_request’s dbManager 300 times. If it returns multiple values we will again have to call dbMnager of quatations many no. of times(many of them will be unwanted) affecting performance.

My question is what is the best way to design it in a proper oo way without hitting the performance.

  • 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-05-18T21:25:04+00:00Added an answer on May 18, 2026 at 9:25 pm

    This is a rather larger question than can easily be handled quickly, but aligning java classes to tables is not necessarily a good approach, precisely because as you note, some things naturally involve multiple tables in complex relations.

    I’d recommend starting by looking at Martin Fowler’s book Patterns of Enterprise Application Architecture.

    Patterns of Enterprise Application Architecture.

    There are also some notes on the patterns in this book at his website.

    Your usage most nearly resembles Table Data Gateway. Following this pattern, it would be perfectly reasonable to have methods in each of your dbManager classes that retrieves data from its associated table but involves another table as part of a where clause.

    You might also want to consider Object-relational mapping as implemented for instance by Hibernate.

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

Sidebar

Related Questions

Consider the following situation: I'm using the Application object in ASP.NET to store a
please consider the following scenario for .net 2.0: I have an event that is
Consider following array $details = array( array('lname'=>'A', 'fname'=>'P','membkey'=>700,'head'=>'y'), array('lname'=>'B', 'fname'=>'Q','membkey'=>540,'head'=>'n'), array('lname'=>'C', 'fname'=>'R','membkey'=>700,'head'=>'n'), array('lname'=>'D', 'fname'=>'S','membkey'=>540,'head'=>'y'),
I have the following class which I'm fighting over how to implement. The question
consider the following code: #define MAX_COUNT 4 static int foo(int w[MAX_COUNT]) { int *p
Consider following snippet code for xml. <rootnode> <child id=child1 ><![CDATA[child 1]]></child> <child id=child2 ><![CDATA[child
I've been running into the following case repeatedly lately, either I need to apply
Let's first consider a simple scenario ( see complete source on ideone.com ): import
Is there a (practical) way to by-pass the normal (virtual) constructor calling order? Example:
In C++, is a const method returning a pointer to a non-const object considered

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.