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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:27:20+00:00 2026-05-27T12:27:20+00:00

I have domain model developed based on DDD concept, pretty much Object Oriented and

  • 0

I have domain model developed based on DDD concept, pretty much Object Oriented and have both state and behaviors in it. The problem is in order to use Hibernate all the persisting attributes has to have getters and setters. This is not appealing since I don’t want to introduce setter for some attributes of my domain objects. Should I map my domain object to DTO instead, which sole purpose is to have maintain just the data.

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

    In general, the two concepts are the same. A domain model is used to describe the model of your objects from the viewpoint of the problem domain (ie. the information used to solve a particular problem or set of problems) and an entity model is used to describe the model of your objects from the viewpoint of a system of actors (in many cases, this is some application that uses the model to solve problems and acts on the entities).

    So, in general, they are the same thing.

    That said, Hibernate is very flexible and in general, doesn’t require you to do much of anything with your persisted objects structure. The key is all in how you define the mappings. In any case, I would not suggest having a DTO just to deal with persisting the data. Hibernate does that all internally using proxies…that’s it’s job. Adding more classes just adds to the complexity of your application and doesn’t really provide much benefit. More complexity is almost never a good thing.

    With Hibernate, you can have private setters, or have Hibernate only operate on the fields and ignore the getters/setters completely. In the first case, you are still introducing a setter, but it is private and so it doesn’t impact the public API of the class. With field-access, Hibernate doesn’t need there to be any getter or setter for a property, but it also goes around any logic you may have had to do other things, like set transient (non-persisted) properties on your objects.

    Have a read through the Hibernate manual, especially on the section about mapping. It is a really flexible ORM that doesn’t restrict you any more than it has to.

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

Sidebar

Related Questions

I have a domain model that consists of fairly large object graphs, where domain
Suppose you have an application that utilizes the domain-model pattern, DDD and lots of
I have a domain model that has the concept of an Editor and a
We have our domain model declared in rusty old hbm files, we wish to
Let's say i have a Domain Model that im trying to make compatible with
Quick background: I'm programming in PHP, I have a domain model with a separate
We have a simple domain model: Contact, TelephoneNumber and ContactRepository. Contact is entity, it
Say I have a nice domain model, using (constructor) DI where needed. Now I
So, I have a nice domain model built. Repositories handle the data access and
My domain model is this: we have a bunch of schools as the root

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.