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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:25:59+00:00 2026-05-25T13:25:59+00:00

We use hibernate in our application and like to use DAO pattern to implement

  • 0

We use hibernate in our application and like to use DAO pattern to implement the data layer of application. I have seen some suggestions on using ValueObjects/DTOs to return data from DAOs

public interface EmployeeDAO {
  List<EmployeeDTO> getEmployees();
}

What is the advantage of returning ValueObjects/DTOs instead of returning hibernate domain objects as

public interface EmployeeDAO {
  List<Employee> getEmployees();
}

Is it not a overkill to copy the data from hibernate object to value object and have two copies of same data in memory. What advantage does ValueObjects really add ?

Are ValueObjects just preferred between business and view layers are should these be used in DAOs

Thanks for any suggestions

Siva

  • 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-25T13:26:00+00:00Added an answer on May 25, 2026 at 1:26 pm

    DTOs should generally be avoided. They can be useful in some situations, though:

    • instead of returning a whole graph of objects, return ad hoc DTOs containing only the interesting information. This makes the code more self-documenting. Otherwise, especially when the returned entities are detached, it’s hard to know which associations are loaded and which aren’t.
    • When you have to return the result of a query which doesn’t return entity instances (aggregations, etc.)
    • When using Hibernate entities at client-side isn’t possible for technical reasons (no access to Hibernate libraries, etc.). Although in this case, it might be the role of the facade layer to transform entities into DTOs rather than the role of the DAO.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some EJBs that use Hibernate to persist data to the database. I
In our Spring application we use clustered Hibernate Search with ActiveMQ which sets up
Our current web application is using SQL Server, we have a requirement for support
I'm introducing a DAO layer in our application currently working on SQL Server because
In our application, we use hibernate + postgres for persistence. Recently, executing one query
For our test fixtures we use NHibernate to generate a database schema. We have
I use ASP.Net with NHibernate accessing a Pgsql database. For some of our Objects,
I use Hibernate with Java. I have two tables which are associated with foreign
We started building our website / application back in 2006, and chose to use
We're developing a data heavy modular web application stack with java but have little

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.