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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:07:12+00:00 2026-05-18T00:07:12+00:00

When programming in Java is it always necessary to code according to the DAO

  • 0
  1. When programming in Java is it always necessary to code according to the DAO architecture? If so what are advantages of using it?

  2. I’m doing a project which has a class diagram like below. what are the disadvantages of this?

alt text

Entity Class:

private void fillSONumber() {
    try {
        ZnAlSalesOrder o = new ZnAlSalesOrder();
        ArrayList a = o.getPendingSalesOrderIDs();
        for (int i = 0; i < a.size(); i++) {
            cmbSoNo.addItem(a.get(i));
        }
        o.close();
    } catch (Terminated ex) {

    }
}

EntityTable Class Example:

public ResultSet select(String fields, String selection) {
    db = new Database();
    db.select("SELECT " + fields + " FROM " + name + " WHERE " + selection);
    return rs = db.rs;
}

and the database class do the connection establishment and destroying.

  • 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-18T00:07:13+00:00Added an answer on May 18, 2026 at 12:07 am

    The purpose of a DAO pattern is to separate what data you are trying to access from how it is stored.

    For example, you could create a DAO that specifies a number of methods that you then implement against MySQL. If you ever decide you need to move to MSSQL or Oracle, you only need to change the implementation, not the interface that could be used in a number of different places in your code.

    It is not necessary to do this, but it can be a good idea to make future changes easier and keep your code decoupled.

    As for your design, the basic layout is fine, but I would recommend against a generic select method like you have. You are basically just creating another layer of abstraction where something could go wrong without any extra benefit.

    It will work well for simple queries, but if you need to do any joins, you will quickly end up with a large mess of methods for different join types.

    It is better to just write your SQL for each type of data you need to access and create a method that returns the type of data you want. This reduces your coupling and allows you to change your implementation if needed.

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

Sidebar

Related Questions

I'm coming to the end of my intro programming class, we're using java and
I'm currently programming an interface between some C++ code and Java using JNI. I'm
I'm programming Java in Eclipse IDE. Here is code I want to read file:
I am programming a Java app in which i need to constantly check that
I am programming in Java I have the code as: byte[] b = test.getBytes();
I'm trying out several exercises from a Java programming book. I have the code
Many Java programmers joke, which all use model DAL, BLL and Facade when programming
when programming in Java I practically always, just out of habit, write something like
Java is one of my programming languages of choice. I always run into the
I come from lots of Java programming and weak at JavaScript.I always used component

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.