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

Take input from Thymeleaf. Translate into ModelAttribute. Doesn't recognize the @ModelAttribute bean. Cannot redirect to new page

I am trying to create a new Movie. This means that I want to access the "addMovie" URL, to generate a form in which I add the title of a new movie. This title should be stored in a movieDTO already from the Thymeleaf form. Then, when I press…
Nexx
  • 51
  • 1
  • 2
  • 7
0
votes
0 answers

Reducing model @Entity bloat with Spring Hibernate and MSSQL using DTO + Stored Proc

Edit: I think it would be helpful to explain my goal here first. My goal is to reduce and avoid model/@Entity bloat when using stored procedures with Hibernate. You can get raw data back from the persistent EntityManager when using a stored…
grantley
  • 127
  • 1
  • 12
0
votes
1 answer

Micronaut POST not creating DTO class

Following the guidelines of the Micronaut database access toolkit, I have the following classes in order to create a new Uploader entity. UploaderController @Post @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public…
Jacob
  • 3,580
  • 22
  • 82
  • 146
0
votes
1 answer

Get null fields after deserialization java JSON

I assume a problen in class structure. But I do not see where. Here is a code. I'm gonna use only some values from JSON. If you need some other code part just let me know. Maily I think I get objest (user) wuth null values here: User userDTOGetOne =…
user15545005
0
votes
1 answer

Efficient way to map nested JSON Objects on DTO Objects

I'm working on a Client Rest and I was asking myself if there is an elegant way to map on DTO objects several JSON objects. I have something like this: { "status": "OK", "error": [], "payload": { "list" : …
0
votes
2 answers

Passing bools from one class to another using a dto

public void GetUserPermission(string username) { using var db = new SOSContext(); { var userAccount = db.Users.SingleOrDefault(x => x.UserName == username); UserPermissionsDTO userPermissions = new UserPermissionsDTO() …
0
votes
1 answer

How to use Dto instead of Model class in hibernate 4

I'm trying to improve search time hibernate runs too many queries to get data which are not necessary
0
votes
1 answer

JSON object losing info between API call and Frontend

I'm making a website that gets its info from a RESTapi I've written and hosted myself, have had no data problems thus far. Now I'm trying a simple retrieve of a json object and I get all the info correctly as shown here in the API. (Visualized &…
Jasper
  • 23
  • 8
0
votes
0 answers

Entity Framework core + OData 8.0.1 CRUD Operations ASP.Net core 5

public class Books { public int Id{get;set;} public string Name{get;set;} } public class BookController : ODataController { private readonly IBookRepository _bookRepository; private readonly IMapper _mapper; …
Java_Dude
  • 97
  • 9
0
votes
1 answer

Automapper with Join query

I'm working on .Net core 3 web API with AutoMapper I have a customer entity and order entity. I have created DTO for each like below public partial class Customer { public int CustomerId { get; set; } public string FirstName {…
Jack
  • 107
  • 1
  • 9
0
votes
2 answers

@JsonProperty annotaion

why do we put @JsonProperty on Setters and Getters in Java DTO, and what is the different between that and putting @JsonProperty on the property? and if we need to put it on both to be reflected, then does it work with @Data lombok annotations?
0
votes
1 answer

JPQL Many-to-many Dto select failure

I want to write JPQL query for selecting a DoctorDto from my AppUserRepository. There is a many-to-many relationship between AppUser and Specialization entity. The two entities are presented below: @Entity @Table(name = "app_user") public class…
0
votes
2 answers

How to allow both uppercase and lowercase in nest.js DTO

I need to allow the user to enter the property name in both upper and lower cases. For example, DTO: import { ApiProperty } from "@nestjs/swagger"; import { IsDefined, Validate } from "class-validator"; export class DicomDto { @ApiProperty({…
Joseph
  • 75
  • 1
  • 6
0
votes
2 answers

How to join 4 tables in 1 DTO with Jpa Query

So I have 4 tables An Employer @Entity @EqualsAndHashCode(callSuper = false) @Table(name = "employers") @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties({"hibernateLazyInitializer", "handler", "jobPostings"}) …
Vuqar Rahimli
  • 11
  • 1
  • 4
0
votes
0 answers

How can I set an entity type within a dto [NestJS]?

I don't even think I've got a proper question so I apologize greatly. I am consuming a 3rd party API and to update or create records, one of the fields is the entity type. For example, here is my CreateOrganizationDTO: export class…
Damon
  • 4,151
  • 13
  • 52
  • 108