Questions tagged [dto]

DTO is an acronym for Data Transfer Object, a design pattern used in data transfer.

DTO is an acronym for Data Transfer Object, a design pattern used in transferring data through internal or external interfaces. A DTO protects the application's internal data by acting as dummy storages, the whole logic is implemented only in actual Domain Objects (DO).

Pros:

  • Fewer remote calls (typically one, getDto() vs. individual getId(), getName(), etc.)
  • Improved data capsulation (Remote systems need only to know the details of the DTO, not DO internals)

Cons:

  • class explosion
  • conversions needed between DTOs and DOs
2100 questions
0
votes
1 answer

Differing DTOs for request/response

I am working with MongoDB and subdocuments. MongoDB generates additional fields that can't be set in a POST, only able to GET them. In other words: different dtos. I am using Swagger and OpenAPI to autogenerate the API documentation and would like…
riggedCoinflip
  • 435
  • 4
  • 16
0
votes
1 answer

Why am I getting nulls registered in my dto?

This is a small spring-boot project. I have to print out : [ { "id":3, "name":”Item1”, "ownerId":1, “ownerUsername”:"User1" } ] instead I get: [{"id":null,"itemName":null,"ownerName":"ivan","ownerId":1}] Here…
georgik1_
  • 1
  • 2
0
votes
0 answers

Can I throw error when client request non-selected-field on entitiy

On my user entity, I set property 'password' with {select: false} options (to prevent client from accessing their passwords). @InputType({ isAbstract: true }) @ObjectType() @Entity('User') export class User { @Column({ unique: true }) @Field(()…
importJWE
  • 73
  • 7
0
votes
1 answer

How to identify different types automatically using Jackson mapper

I have a simple situation. I have a main DTO class with the following fields: AnimalDTO public class AnimalDTO { @JsonCreator public AnimalDTODTO(@JsonProperty("error") boolean error, …
FPerez
  • 1
  • 2
0
votes
0 answers

JOOQ query not mapping results on multi level (one-to-many related) custom POJO

|Table1| 1 n |Table2| 1 n |Table 3| | | --------------> | | --------------> | | | | | | | | -------- -------- …
ihaider
  • 1,290
  • 4
  • 19
  • 38
0
votes
0 answers

Included properties returns null

I have a table named employee: public class Employee { public int Id { get; set;} public int SupervisorId {get; set;} public int EmployeeStatusId{ get; set; } public EmployeeStatus EmployeeStatus{ get; set; } …
Taxyy
  • 33
  • 4
0
votes
0 answers

Getting getters from Java 17 subclasses, DTO

What could be the problem ? I have a DTO class where I get john , after which I need to pull these values out of there and set them to another object. Previously, I did it via VS code and everything worked fine. I moved these classes to the INTELLIJ…
eva_mila
  • 53
  • 6
0
votes
1 answer

ModelMapper DTO to Entity

I am working on a project for my class. Need to map DTO to Entity and vice versa. My DTO does not have an Id field and conversion is happening at Controller Layer. 2 other classes are extending my entity, thus @Superbuilder. My conversion Entity ->…
TheNope
  • 1
  • 1
  • 3
0
votes
1 answer

DTO definition in presentation layer and application layer

I am learning about DDD and I would like to say what is the correct way to implement DTO using DDD principles ? In my onion architecture I implement a first DTO definition in presentation layer to map datas between RabbitMQViewModel(presentation…
0
votes
1 answer

How map List into DTO

I have this problem, this is my DTO: public class OrderDTO { private Long id; @JsonProperty("_embedded") private OrderEmbeddedListJsonDTO embedded; } Here my other DTO: public class OrderEmbeddedListJsonDTO { private List
0
votes
1 answer

Symfony 5 Rest, Base64 encoded file to DTO with validation as File object

I have a PostController looking like this: #[Route(name: 'add', methods: ['POST'])] public function addPost(Request $request): JsonResponse { /** @var PostRequestDto $postRequest */ $postRequest = $this->serializer->deserialize( …
Slimu
  • 88
  • 8
0
votes
1 answer

Error creating bean with name 'activityController'

I'm having this problem while running on Server (Tomcat) my project. I have created a Maven project using Spring. The Java version is Java 1.8. NO SPRING-BOOT! Error creating bean with name 'activityController': Unsatisfied dependency expressed…
0
votes
1 answer

How to create instance with Lombok with extend field

I have next problem. I have this method: public void sendDeletedEvent(final Comment comment) { log.info("SendDeletedEvent.E with Comment: {}", comment); final CommentDTO commentDTO = commentMapper.toDTO(comment); final…
0
votes
1 answer

SonarQube: "Store a copy of "productAllergenInfos""

I have the following DTO: @Data @RequiredArgsConstructor public class MenuItemExpandedDTO { private UUID uuid; private List modifierGroupDtoList; private List allergenInfoList; public MenuItemExpandedDTO( …
Jack
  • 1
  • 21
  • 118
  • 236
0
votes
1 answer

Messages not translating into different language in STS thymeleaf

In spring boot, for validating field of thymeleaf form, I am having multiple languages, so when I translate the form into different, my validation message is not translating its show in English. I have different property file for each…
developer_user
  • 463
  • 2
  • 5
  • 13