Defect #393
closed
Added by Filip Měšťánek about 7 years ago.
Updated about 7 years ago.
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.
- Priority changed from Normal to Immediate
- Priority changed from Immediate to High
- 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.
- 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.
- Status changed from Resolved to Closed
Also available in: Atom
PDF