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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:04:17+00:00 2026-06-17T12:04:17+00:00

Is DAO class responsible for handling all following methods? Or it’s better to exclude

  • 0

Is DAO class responsible for handling all following methods? Or it’s better to exclude some methods into service layer?

I found this interface here . And I think about repeating this interface in my code..

public interface GeneralDAO {

        public <T> T find(Class<T> type, Serializable id);

        public <T> T[] find(Class<T> type, Serializable... ids);

        public <T> T getReference(Class<T> type, Serializable id);

        public <T> T[] getReferences(Class<T> type, Serializable... ids);

        public boolean save(Object entity);

        public boolean[] save(Object... entities);

        public boolean remove(Object entity);

        public void remove(Object... entities);

        public boolean removeById(Class<?> type, Serializable id);

        public void removeByIds(Class<?> type, Serializable... ids);

        public <T> List<T> findAll(Class<T> type);

        public List search(ISearch search);

        public Object searchUnique(ISearch search);

        public int count(ISearch search);

        public SearchResult searchAndCount(ISearch search);

        public boolean isAttached(Object entity);

        public void refresh(Object... entities);

        public void flush();

        public Filter getFilterFromExample(Object example);

        public Filter getFilterFromExample(Object example, ExampleOptions options);
}
  • 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-17T12:04:18+00:00Added an answer on June 17, 2026 at 12:04 pm

    All of the methods listed on your GeneralDao are compatible with the DAO pattern.

    Also, its possible to have methods specific to the entity your working with, as long as they relate to persisting/retrieving from storage. . For example a CustomerDao: besides having the methods on your GeneralDao might have methods to find by criteria relating to a customer. . . If you can present this in a specific way that leads to more descriptive-code, then so much the better. There’s nothing wrong with specifics and focusing in on an entity.

    (CustomerDao, OrderDao, ProductDao, . . PilotDao, BookDao, etc. All of these could have unique methods relating to storage and retrieval of that type of entity)

    You’ll know that you’re still honoring the DAO pattern if you could swap the underlying persistent store for something else, and the DAO still makes sense.

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

Sidebar

Related Questions

The following are methods I currently have in an Abstract DAO class. If there
Hi I generate Dao classes for some DB operations in this manner making methods
I have a dao jar file that contains all the domain objects and service
My implemented methods are not getting called from DAO Class. I created bundle xml
I have the following code in the Controller class and for some reason although
I want to instantiate a Datasource in the Dao Class. I'm following the Spring
I have a DAO class with many methods that have a lot of repeated
I created a service responsible for contact with database through dao. I used @Transactional
Just started using JAX-WS. I created service class and DAO class. My service is
I have such things as: 1) DAO class with methods, used to perform transaction,

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.