Ignore Specific Field(s) on POJO in all mapping implementations Mapstruct

My persistent entities has fields createdBy, createdAt, modifiedBy, modifiedAt.
I would like mapstruct to always ignore mapping these fields, since they are autogenerated using hibernate annotations.
I don't like the idea of doing @Mapping(target = ..., ignore = true) repeatedly.

Is there a way to do this at the, for e.g. at my entity level, instead of the Mapper method level?
Or is there some other better solution than repeating the annotations?

bit more context - the mapping implementations use builders generated by lombok.
my entites can either extend UpdatableEntity or BaseEntity
all my entities, UpdatableEntity and BaseEntity use @SuperBuilder
BaseEntity has createdBy and createdAt
UpdatableEntity has modifiedBy and modifiedAt and extends BaseEntity



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)