Project

General

Profile

Actions

Defect #393

closed

DTO to entity conversion

Added by Filip Měšťánek about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
High
Assignee:
Vít Švanda
Category:
Dto mapping
Target version:
Start date:
05/03/2017
Due date:
% Done:

90%

Estimated time:
Affected versions:
Owner:

Description

When having a protected setter on the DTO, the conversion between entity is not working. In my example, one field is set only in constructor, therefore protected setter is required (maybe even better to have it as private).

The other problem is when I have UUID as a field. Both DTO and entity have UUID field (it is NOT a reference!). I set the UUID to the DTO and when I save it, it is not there anymore.

Actions #1

Updated by Filip Měšťánek about 7 years ago

  • Priority changed from Normal to Immediate
Actions #2

Updated by Vít Švanda about 7 years ago

  • Priority changed from Immediate to High
Actions #3

Updated by Vít Švanda almost 7 years ago

  • Category set to Dto mapping
  • Status changed from New to Needs feedback
  • Assignee changed from Vít Švanda to Filip Měšťánek
  • I think, automatic mapping private or protected setters are not good idea. DTO should have public getters and setters generaly. If you need use extra mapping rules, you can override method "AbstractReadDtoService.toDto".
  • I try simulate problem with mapping UUID to UUID, but without success. My usecause: I changed type of field in entity (AccRoleAccount) from IdmRole to UUID. In DTO I removed annotation "embedded". Mapping works correctly ... after save DTO was returnded DTO with filled UUID.
Actions #4

Updated by Vít Švanda almost 7 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Filip Měšťánek to Vít Švanda
  • Target version set to Citrine (7.3.0)
  • % Done changed from 0 to 90

Problem with UUID conversion was in ModelMapper, where is as default set strategy with "inteligent" mapping by field name (camle case).
I set as default STRICT strategy. Now works fine.

Actions #5

Updated by Vít Švanda almost 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF