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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:18:03+00:00 2026-05-19T12:18:03+00:00

I have a DAO with a method CommitmentListDAO.getListByOwnerBadge that returns an arraylist of commitment

  • 0

I have a DAO with a method CommitmentListDAO.getListByOwnerBadge that returns an arraylist of commitment items against a supervisor badge (database field OWNED_BY)

    String SQL_VIEW_LIST_BY_SUPERVISOR = SELECT_QUERY + 
    " WHERE c.OWNED_BY = ? " +
    " ORDER BY p.PROGRAM_NAME";

Now, I want to add a pull down on my web form to allow the user to choose between Owned By or Tasked To
I’ll need to add a WHERE c.TASKED_TO = ? clause in the DAO.

Do I perform the logic for which field to search on within the DAO – say a passed in parameter of the pulldown (Never the request object) and rename the method to getListByBadge(String whichField, String badge) or should my CommitmentListForm class have this logic and then make the appropriate call to either getListByOwnerBadge or getListByTaskeToBadge

  • 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-19T12:18:04+00:00Added an answer on May 19, 2026 at 12:18 pm

    I would go with a DAO on it with two different methods to clearly differentiate what the call does.

    The point of a DAO is to hide the SQL implementation details. You should always consider a question like this from the standpoint of, “What if I switched to a different persistence mechanism, like HBase?” The HBase implementation may not store this in a way that simply differentiates by a field name. The DAO should make it possible to hide that detail, thus the different methods.

    Just my opinion, of course. 🙂

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

Sidebar

Related Questions

It is often useful to have a field in a DAO whose value comes
If you have a call in a Dao method like (pseudo code): return ..getHibernateTemplate(
I have a method that is going to the DB so all our JDBC
I have an NHibernate Dao..lets call it MyClassDao for want of a better name.
I have developed some custom DAO-like classes to meet some very specialized requirements for
Usually when defining a DAO, you would have a setter for the datasource on
I'm using Spring.net with NHiberante (HibernateTemplate) to implement my DAO's. I also have some
I have an application that I am currently writing that will use Spring and
I have a quick question that I could not figure out in the docs
The following are methods I currently have in an Abstract DAO class. If there

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.