Here’s why adding @BeanMapping(nullValuePropertyMappingStrategy = IGNORE) didn’t work in your case.


❓ What You Expected

You added:

@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)

Your expectation:

“If a field like organizationStatus or organizationTier is null in the request DTO, then don’t map it — keep the default value defined in the entity.”


🧠 How It Actually Works

That expectation is only true if you’re updating an existing instance, like this:

void updateOrganizationFromRequest(OrganizationUpdateAdminRequest dto, @MappingTarget Organization existing);

In that case, nullValuePropertyMappingStrategy = IGNORE tells MapStruct:

“If the value in the DTO is null, don’t overwrite the existing property in the entity.”

But you’re not doing an update — you’re doing a full create.

In your case:

Organization toEntity(OrganizationCreateAdminRequest organizationDTO);

MapStruct creates a new Organization instance from scratch, using the default constructor + direct field assignment. So when it encounters null values in the source DTO, it explicitly sets them to null on the new entity, which overrides your @Builder.Default values.


🚫 Why @Builder.Default Fails Here

Lombok's @Builder.Default only works when: