Questions tagged [entity]

An entity is an object or a set of data that has an identity that persists changes of its attributes. In an object oriented context, it usually refers to long-lived information relevant for the stakeholders of the system.

An entity is an object or a set of data that has an identity that persists the changes of its attributes. In an object oriented context, it usually refers to long-lived information relevant for the stakeholders of the system (i.e. domain objects) and in general stored in a database.

127 questions
85
votes
14 answers

Do objects in OOP have to represent an entity?

Does an object have to represent an entity? By an entity I mean something like a Product, Motor, a ParkingLot etc, a physical, or even a clear-cut non-physical conceptual object -- something that is well defined, with some core data clearly…
Dennis
  • 8,157
  • 5
  • 36
  • 68
49
votes
1 answer

What is the use of DTO instead of Entity?

I am working on RCP application, I'm new to this application. Spring beans are used to write business logic to save/fetch entities. But, instead of sending entities directly to client we are converting to DTOs and populating client. While saving, we…
Naveen Kocherla
  • 613
  • 1
  • 6
  • 5
16
votes
2 answers

Entity to DTO Usage

Been trying to come up with a flow for a basic tiered web application, and have been reading conflicting information online. What I'm trying to figure out is if there is an advantage to still using DTO objects from your DAO to Service layer through…
dardo
  • 355
  • 1
  • 2
  • 11
15
votes
4 answers

Should entities contain information about their amount?

Can I get some thoughts on the entity design? Let's say I have an entity called Book. Let's say I create a specific instance of that book. It has a title A and an author B. Since there can be multiple books, should the amount be included in the…
Kleronomas
  • 169
  • 1
  • 6
15
votes
4 answers

Accessing Repositories from Domain

Say we have a task logging system, when a task is logged, the user specifies a category and the task defaults to a status of 'Outstanding'. Assume in this instance that Category and Status have to be implemented as entities. Normally I would do…
14
votes
2 answers

Are the Repository Pattern and Active Record pattern compatible?

Currently I am developing a webapp where I have defined models implementing the Active Record pattern. Each model also is defined by an interface that specifies the Entity properties and makes it easy to inject it into other classes, specially…
12
votes
2 answers

How to design the aggregate boundaries?

I would like to write an application something like ecommerce. And you know that in similar applications products could have different properties and features. To simulate such an opportunity I've created the following domain model…
cephei
  • 143
  • 1
  • 8
12
votes
4 answers

When should we use weak entities when modelling a database?

This is basically a question about what are weak entities? When should we use them? How should they be modeled? What is the main difference between normal entities and weak entities? Does weak entities correspond to value objects when doing Domain…
Songo
  • 6,548
  • 4
  • 48
  • 89
11
votes
2 answers

Repository pattern vs DAO managing Entities

I am new to concepts like DAO, DAL and Domain Driven Design. In the end I want to decouple the persistence layer (mysql database) from my business objects and logic in a web application. I liked the DAO concept but I got stuck implementing it when I…
Michbeckable
  • 221
  • 1
  • 2
  • 4
10
votes
2 answers

How to create new aggregate root in CQRS?

How should we create new aggregate roots in cqrs architecture? In this example I want to create new aggregate root AR2 that holds reference to first one AR1. I'm creating AR2 using AR1 method as starting point. So far I see few options: Inside…
10
votes
2 answers

Should well-known business ID of an entity be represented with a dedicated type in DDD/OOP?

In practical terms it means using an custom (immutable) class over a string or some other primitive type. Examples: Publishing: International Standard Book Number. Finance: International Securities Identification Number. Advantages: Can ensure…
Den
  • 4,827
  • 2
  • 32
  • 48
10
votes
3 answers

Entity Framework Entities - Some Data From Web Service - Best Architecture?

We are currently using Entity Framework as an ORM across a few web applications, and until now, it has suited us well as all our data is stored in a single database. We are using the repository pattern, and have services (the domain layer) which use…
stevehayter
  • 153
  • 1
  • 7
9
votes
1 answer

Data Objects for each layer(DTO vs Entity vs Response objects)

Let's say I'm building a Customer web application(in Spring Boot 2), which also exposes rest end points. I'm modeling my application into 3 layers. a) UI - CustomerDTO b) REST - CustomerRESTResponse/CustomerRESTRequest Service - CustomerDTO Data…
Sandeep
  • 103
  • 1
  • 1
  • 5
8
votes
2 answers

Why can't Entities leave the inner layers in the Clean Architecture?

I was reading about the clean architecture, and I don't get this part: Don't use your Entity objects as data structures to pass around in the outer layers. Make separate data model objects for that. As long as I don't let the entities leak out…
Luís Soares
  • 271
  • 1
  • 7
8
votes
1 answer

Shall the Database in a sequence diagram be represented as actor or boundary?

I'm designing a system made of a web application and database. I use the <> - <> - <> stereotypes in my UML diagram. In the following sequence diagram, I already have an interaction with a system in the cloud. I want…
khalid
  • 101
  • 1
  • 1
  • 3
1
2 3
8 9