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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:39:09+00:00 2026-06-10T10:39:09+00:00

DAO, also called mapper (I think), is a Core Java EE pattern . I

  • 0

DAO, also called mapper (I think), is a Core Java EE pattern.

I love this pattern since (IMO) creating a layer of abstraction between code and SQL increases a lot the quality of the code.

I usually follow the Java EE pattern, but when you need some really specific data from the DB, I feel a little bit lost. I am not sure who should be responsible for retrieving that data.

My approach is usually to create a UserModel class, in which I store the most used parameters, and in the DAO I create a method getUser(param: String): UserModel. But, what if there is a column in the DB which of course is needed, but not so often. What is the best approach?

Do you think DAOs should provide methods like (e.g.) getUserID(): String or isUserVerfied(): Boolean? or do you think the responsibility of the DAO is just providing the basics (update/delete/insert/select) methods?

Basically, the question is, when you need some data which is not used a lot in your code, what is the best approach, create a select() method in your DAO which loads everything (of users’ table (e.g.)) in your model. Or having some specific method like isUserVerified(): Boolean despite this is not part of the pattern? Or there is another approach which works in both situations (often use fields and not often used fields)?

Please note that the answer should be the most language-independent as possible.

  • 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-10T10:39:10+00:00Added an answer on June 10, 2026 at 10:39 am

    The purpose of a DAO is to hydrate complete objects, and in most cases it shouldn’t be a problem to always load all of an object’s fields. Not loading columns that are “not used a lot” while you don’t experience performance problems seems like premature optimization.

    When dealing with really big columns (images, BLOBs…) though, you can use lazy loading, either through your ORM or by hand. The method that loads the column could be in the DAO, or in a specific service.

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

Sidebar

Related Questions

We have implemented a typical DAO/Abstract Factory pattern. The design is like this: DAOFactory
I have this DAO.. public class AreaDAO { private Database database; public AreaDAO(Database database)
Hi I generate Dao classes for some DB operations in this manner making methods
this is my first and also I am beginner in Spring.NET and also AOP.
We're using Grails but with an existing model layer and DAO layer. We have
I have a generic DAO class that looks like this: public class GenericDaoJpa <T
I am getting this exception when I call a DAO method which uses SessionFactory.getCurrentSession()
I'm using Hibernate and Spring with the DAO pattern (all Hibernate dependencies in a
The interface for service layer is : EMS.java: public interface EMS extends UserDetailsService {
I'm using Spring.net with NHiberante (HibernateTemplate) to implement my DAO's. I also have some

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.