Skip to main content
The 2024 Developer Survey results are live! See the results

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.

Filter by
Sorted by
Tagged with
1 vote
3 answers
110 views

DDD: big immutable item with some references to entity identifiers, should it be value object or entity?

Let's say I have a Mail, this mail have many properties given by the constructor (for example, 10-15 parameters). This mail can't be edited (immutable), the user has specifically requested to send ...
Vianney's user avatar
  • 19
1 vote
2 answers
132 views

Entities can move from one Clean Architecture use case to another using the controller?

I'm working on a project with the task of creating a route to checkout ticket purchases for events. In this scenario, I have a controller that receives the request with order data, client information, ...
Victor Antunes B.'s user avatar
0 votes
6 answers
241 views

is employee just a user in domain driven design

Suppose I have an application where I can manage clients (just companies I offer my services to) and what services I offer for them. I also have the functionality to create timebookings, which means I ...
hadamard's user avatar
  • 140
0 votes
1 answer
138 views

Deriving entities in different domains from one DB table

Let's say I have a table for storing users. In this table, I have data like id, name, address, bank account and birthdate. Also, I have two domains in my codebase; in one of them, I need a user entity ...
Bernardo Benini Fantin's user avatar
1 vote
4 answers
212 views

How to Access the Private State of an Entity in the Save Method of its Repository

Consider the domain entity, Order, which can be persisted by the OrderRepository. Orders maintain state that is stored in the database. However, it does not expose all of it directly. That is, parts ...
STHA's user avatar
  • 49
1 vote
5 answers
296 views

Data Modeling: Are technical concepts within a tool that implement a business entity entities as well?

I believe this forum is the correct one for my question, based on the community guidelines but let me know if not. It seemed like the best fit. I am performing a data modeling exercise to formulate a ...
Steven's user avatar
  • 229
1 vote
1 answer
198 views

Database design for graph where nodes can be other graphs

How should I design a relational schema to store graph documents that can contain plain nodes (shapes, in the example below) as well as nodes that can reference other graph documents? To visually ...
rink.attendant.6's user avatar
0 votes
0 answers
142 views

How to design entities to keep up with the depth of JSON objects?

To better context see Rich Authorization Requests for OAuth2 As u can read here there are some common data field types like actions, locations etc. So I have created C# entity for EF as below: public ...
Szyszka947's user avatar
-1 votes
3 answers
308 views

Is it ok to save all fields of an entity as a string if it should not be changed?

I have a complex object that has several fields can be updated until it is locked. Is it proper to save this locked entity as another entity which has no object child, only string data. complex object ...
AhuraMazda's user avatar
0 votes
1 answer
294 views

In DDD, must a Value Object turn into an Entity when some limited idenifiablity is required?

I have an Entity type, let's say Car for example. There is a Value Object type Tire for it. Each car has a set of tires with certain properties. Sometimes tires are replaced, which is communicated by ...
Erik Hofer's user avatar
0 votes
2 answers
1k views

Is it okay for an Interface Adapter / Repository / Gateway to use Entities in its implementation

I've got these classes: enum Environment { case staging case production static func current() -> Environment { #if STAGING return .staging #elseif PROD ...
Bawenang Rukmoko Pardian Putra's user avatar
3 votes
1 answer
448 views

Should repositories return self persisting entities?

In domain driven design A repository is a collection like "interface" that hides data source access. It furnish add, remove and retrieval method just like a collection would. It does it ...
Ced's user avatar
  • 589
0 votes
5 answers
167 views

Metadata persisted or created at runtime?

Let us say I have an entity House that I want to store on a database. The House has an attribute yearBuild. If the house was build before 1990 its status should be 'ToBeSelled'. Now I have two ways to ...
Cap Barracudas's user avatar
1 vote
4 answers
308 views

Dilema about having a Country, Province, City model separate Aggregate or in the same aggregate

We are porting an old monolith application and we are trying to apply the DDD concepts, we started looking for what we think are the Bounding Contexts of the application. We have what we thought would ...
mmas's user avatar
  • 33
1 vote
2 answers
857 views

determine correct relations in ERD - Customer Orders use case

The below ERD is taken from a professional architecture reference, however I have a concern in the relation between Customer and Invoice, I believe that relation between Customer to Order , and Order ...
osama yaccoub's user avatar
0 votes
2 answers
747 views

ER Diagram - How to display relationships between Entities that are a type of another

I face a problem in understanding how this situation can be traduced to an ER diagram. So I have an entity, let's call it car, and then, there are another entities, that are a type of car. For example,...
S. Dre's user avatar
  • 111
0 votes
0 answers
176 views

Splitting nested entities keeping invariant within aggregates

I'm currently developing message imap-based module in crm app and i'm trying to connect dots using ddd principals. I've started with three main entities, all bound under Account Aggregate: Account - ...
devmr97's user avatar
2 votes
0 answers
895 views

Clean Architecture, what are objects that does not completely fit as entities?

I'm reading chapter 20, "Business Rules", of clean architecture book, in this chapter Uncle Bob defines entities as: An Entity is an object within our computer system that embodies a small ...
Thiago Dias's user avatar
0 votes
2 answers
614 views

DDD Modeling - Entity with generic and specific data

Suppose I am buying coffee. There are several types of coffee (A1, A2, A3), but sometimes I want to make a reference to all types of coffee (like if I had a coffee "grouped"). Considering ...
André Luís Oliveira's user avatar
1 vote
1 answer
588 views

Dealing with business logic on DTOs using a DDD

I have a scenario in which an Entity defines an EntityRepresentation that is created from another end. The EntityRepresentation is a value object that implements some logic that should be performed on ...
Antonio Santoro's user avatar
-2 votes
1 answer
378 views

DDD Best way to preserve integrity of entity

I have an entity that contain the status of data (WaitingForData, ReadyForData, DataUsed). class Batch { int Status { get; } DateTime StartTime { get; } string Code { get; } void ...
FedeC87p's user avatar
2 votes
3 answers
7k views

When to use entity and when to use DTOs

Hi I am very new to using DTOs, and I am starting to understand it slowly, but there are still some missing puzzles for me. I understand the use of DTOs in the way of decoupling the persistence data ...
user9347049's user avatar
-1 votes
1 answer
392 views

Modeling a workout schedule using OOP(DDD specifically)

I am just getting into DDD, and I am trying to model a very basic exercise schedule. I have a Schedule and I have a Slot the slot takes 0 - many Exercise entities. The schedule is composed of Slots ...
user3832583's user avatar
15 votes
4 answers
3k views

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 ...
Kleronomas's user avatar
-1 votes
2 answers
132 views

How to change a data model

In my model a user entity has three attributes : ID, name, hasBoyfriend. I want now to change hasBoyfriend to boyFriendsNames which is an array of names . The user entity is used by many services. The ...
Cap Barracudas's user avatar
1 vote
2 answers
2k views

Relationship between entities in different aggregates and size of aggregate

I read a lot about DDD but few thing are still unclear. At this moment I have two dilemma The size of aggregates. How small could be an aggregate? For example we have: class Car { String colorId ...
pin54's user avatar
  • 19
2 votes
2 answers
1k views

Database Design: Storing price date wise, or date range wise?

I must store prices for various items on multiple dates. The table schema would look like this: CREATE TABLE date_wise_price ( item_code varchar, date date, price numeric(19,4) ) An ...
Rohit Jain's user avatar
-3 votes
1 answer
56 views

What is proper approach to code first entity relationship design?

I been trying to figure out, what i hoped is a simple problem, but am yet to land with an answer. How do you go about designing an entity relationship diagram when doing code first development? The ...
Aeseir's user avatar
  • 247
2 votes
2 answers
947 views

Entity delete validation in a microservice environment

In a microservice environment there are two services: Service A and Service B. Service A manages an entity called x which has one to many relationship with service B's entity called y When a network ...
inckka's user avatar
  • 129
1 vote
1 answer
103 views

How to decide on abstraction level and entity definitions?

I am working on a hobby project of mine where I want to make an application to doing my personal finances. Just for learning. I am trying to adhere and implement best practices and patterns to learn ...
avanwieringen's user avatar
2 votes
1 answer
768 views

Can I put domain services inside domain entities?

Say I have a domain entity User: class User { constructor (username, email, password) { this.username = username this.email = email this.password = password } } Now, all users need a ...
kibe's user avatar
  • 748
0 votes
1 answer
7k views

Best practice for references in DTOs and entities in Spring

Given the following architecture and frameworks: Spring Boot Application with Spring Data JPA (Hibernate is used as OR mapper); layered architecture as followed. REST layer Service layer Persistence ...
keezar's user avatar
  • 27
8 votes
2 answers
2k views

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. ...
Luís Soares's user avatar
0 votes
1 answer
506 views

Need for a domain model in a service in 3 tier architecture?

I am building an API Rest with Spring Boot and I would like to clarify a concept about my architecture, to see if the community can help me. Imagine that in my database I have a table called Person. ...
Mr. Mars's user avatar
  • 121
0 votes
0 answers
589 views

DDD Value Objects and Entity Without ORM Mapping in PHP

First, as I know, Entity in DDD is almost same with Value Object except Entity has identity. Every article I have read say same thing that entity id has ORM mapping with any ORM tool. But I don’t want ...
Furkan's user avatar
  • 101
2 votes
0 answers
302 views

Changing entities in Clean Architecture

I'm modeling the "Domain" Layer of "Clean Architecture" for an application that gets its data from an XML file when starts. The XML file looks like: <?xml version="1.0" encoding="UTF-8" ?> <...
trofinao's user avatar
1 vote
2 answers
2k views

When to model an aggregate's entities as part of a value object?

I've read a lot about Domain Driven Design including books from Eric Evans and Vaughn Vernon. So I am familiar with the concepts Aggregate Root, Entity, and Value Object. But while I was modeling ...
Jonny Dee's user avatar
  • 957
7 votes
3 answers
13k views

Domain vs Entities model? Domain-Driven-Design (DDD)?

In this github, https://github.com/johnph/simple-transaction, under the Transaction.Framework project, there are entities (located at Data/Entities) AccountSummaryEntity.cs AccountTransactionEntity ...
Steve's user avatar
  • 299
3 votes
4 answers
468 views

What is optimal number of entity abstraction levels?

Sorry about the vague question, please do suggest different formulations. Anyway here is the kernel of the question: How many classes representing an entity/resource or whatever you want to call it, ...
Pavel Schoffer's user avatar
7 votes
1 answer
2k views

How to prevent concurrency problems when using the repository pattern?

Considering that: when using the repository pattern you deal with entities - those are the atomic units you persist (regardless of Hibernate or "manually") when changing an entity you save it as a ...
Luís Soares's user avatar
1 vote
1 answer
3k views

Aggregate root being created by multiple other aggregate roots

I know the title is confusing, I didn't how to word it. I'm studying the Domain Driven Design (DDD) and I'm reading the book "NET Microservices Architecture for Containerized NET Applications" from ...
mmas's user avatar
  • 33
2 votes
1 answer
635 views

Can we have a ternary relationship together with a recursive one in E-R diagrams

I am designing an E-R Diagram for a simple system where there are some users and contests. A user can create a contest or invite other users to the contest who can decide to accept or not. I am ...
Tommy95's user avatar
  • 39
1 vote
1 answer
2k views

How to determine aggregates when entities are shared?

So I'm trying to figure out exactly what my aggregates/aggregate roots are in my structure, and can't seem to wrap my head around it. Database contains the following tables: SALESGROUP ID ...
Sarov's user avatar
  • 403
3 votes
2 answers
5k views

Depend on DDD Entities or Interfaces?

My understanding is that the dependency inversion principle does not apply to entities, because entities basically are your application - it generally doesn't make sense to swap out a different ...
Sarov's user avatar
  • 403
-3 votes
2 answers
1k views

What is DDD's concepts mapping to microservice's concepts? [closed]

DDD concepts: Domain, Aggregate, Entity, Value object, Bounded context Should every aggregate be a single microservice and have a single DB ( since every microservice should have a single specific DB)...
J.J. Beam's user avatar
  • 461
0 votes
1 answer
89 views

Do menu option lists (and similar labels) belong in the database?

I am moving in the direction from database-centric design to entity-centric design (say, starting with class definitions instead of starting with a ERD), and am questioning things: Often in a ...
S'pht'Kr's user avatar
  • 199
4 votes
2 answers
2k views

Repository pattern usage

I need some advice regarding repository pattern. Let's assume i have UserBal which stands for business logic which uses UserRepositoryDal where all database logic for that entity stands (queries to ...
Arie's user avatar
  • 149
1 vote
1 answer
694 views

Using the same entity for different use cases

Suppose I have a User entity with name and age attributes. A User can own Boxes. A Box has the name and color attributes. Business rules dictate that one User can own at most 5 boxes. So, in this case,...
dddwonderer's user avatar
1 vote
2 answers
877 views

Domain models vs entity models vs Hibernate lazy loading

In a new Java project I plan to use an extra layer above Hibernate entities. So there would be a CustomerEntity and CustomerDomain. The reason for that is that the CustomerDomain can contain extra ...
Vmxes's user avatar
  • 147
0 votes
1 answer
603 views

Modify a property of an aggregate's entity

Suppose I have a house-lending service, like Airbnb. I have a House entity, which can have a name. There's also the Reservation entity, which has a start date, an end date, and a name (which isn't ...
dddwonderer's user avatar