Entity mapping to DTO with DI with MapStruct

Ahmad Abdulaziz

I am new in mapstruct and I am using spring as DI I follow up MapStruct documentation page regarding DI containers section 4.2 I tried to map my entity to dto as below :

@Mapper(componentModel = "spring")
public interface CustomerMapper {
@Mapping(source = "registered",target = "activeProfile")
CustomerDto customerToCustomerDto(Customer customer);
}

when i run mvn install i got this error :

java:27: error: No property named "registered" exists in source parameter(s).
@Mapping(source = "registered",target = "activeProfile")

my entity using lombok and I am sure there is registered field

please help

Ahmad Abdulaziz

I removed lombok from Entity and created setters /getters manually and worked well

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

mapstruct mapping Entity OneToMany to DTO and reverse

Mapping DTO with final members in MapStruct

MapStruct 3 Entity 1 DTO

Why do not I get the id when mapping from DTO to entity with mapstruct?

Mapping to DTO bidirectional entities in SpringBoot with MapStruct

Dto from multiple string in Entity mapstruct

Dto to Entity conversion using MapStruct gives error

DTO mapping exception with entity in ABP

Error when mapping from Entity to DTO or DTO to Entity using AutoMapper

Mapping between JPA entity and DTO in CQRS

Kotlin DTO Entity mapping recursion problem

AutoMapper Entity to Dto Conversion: Mapping Type Error

Mapping from Entity Type to DTO in API application

Entity Framework stored column mapping issue with DTO

ModelMapper return Null in DTO fields while mapping from Entity to DTO

@Mapping annotation is not mapping correctly to convert Entity object to DTO object

Mapping Entity Framework entity to dto object using select

Mapping DTO an Entity, leave entity null if all your field is null

How to use mapstruct to automatically map Entity and Entity objects inside Entity to fields in Dto?

Map a dto to an entity retrieved from database if Dto has Id using MapStruct

MapStruct: Fields from Different Entities mapping to Same Entity Different fields

what would be the configuration for mapStruct to stop mapping a DTO's super class's fields?

java mapstruct 1.3.1 ignore property in a list for bi-directional DTO mapping

Automapper -> DTO to Entity - How to trigger Setter validations when mapping

JPA mapping native query result to non entity DTO

Auto mapping (with AutoMapper) from DTO to an entity with many-to-many relationship in it

Null values after mapping my DTO to my Database Entity

Spring boot: Custom mapping between DTO and Entity using ModelMapper

MapStruct DTO property

TOP Ranking

HotTag

Archive