1,597 questions
0
votes
1
answer
78
views
@Pattern and @NotBlank on password field still triggered even when password is null, validation groups cause MapStruct mapping issues
I have a PATCH endpoint for updating user details. My UserRequest record has @Pattern and @NotBlank on the password field. I am facing two problems, one before using validation groups and one after.
...
Best practices
0
votes
0
replies
68
views
Best pattern for Mapstruct updater when a field can't be constructed/built without parameters
A simple mapper which also provides and 'update' mapper
@Mapper(componentModel = "spring", uses = "EngineMapper.class")
public interface CarMapper {
CarEntity carDtoToCarEntity(...
0
votes
2
answers
70
views
Mapstruct implementation cannot find mthod builder
I'm encountering the message below at runtime when my application tries to map my entities to Dto classess using Mapstruct and Lombok together in spring boot
java: cannot find symbol
symbol: ...
0
votes
1
answer
89
views
Mapstruct inherit 'uses'
Given the following classes:
public abstract class MyAbstractB {
private B b;
}
public abstract class MyAbstractBDto {
private BDto bDto;
}
public class ItemWithB extends MyAbstractB {
private C ...
0
votes
2
answers
113
views
MapStruct not mapping nested fields without explicit mappings when multiple source parameters are present
I have two similar DTO classes and a MapStruct mapper. When mapping from one object with additional String parameters, nested fields aren't mapped automatically — they become null unless explicitly ...
1
vote
0
answers
30
views
Mapping multiple derived classes with differing field names [duplicate]
I have several classes as follows:
@Data
public class Parent {
long id;
String name;
}
@Data
public class Child extends Parent {
String nickName;
}
@Data
public class Grandchild extends Child {...
0
votes
0
answers
76
views
Mapstruct and multiple derived classes
I am having trouble wrapping my head around subclass mappings. I have 3 classes:
@Data
public class Parent {
long id;
String name;
public boolean isEmpty() {
return StringUtils.isEmpty(name)...
1
vote
2
answers
140
views
mapstruct generated implementation cannot find imported class in multi-module Spring Boot project
I am using clean architecture and have 3 modules: application -> details -> core
I'm trying to use Mapstruct to generate mappers in application & mappers in details. I have this mapper in ...
0
votes
1
answer
205
views
Java 17 Upgrade: Cannot find symbol error with Lombok `@FieldNameConstants` and MapStruct
After upgrading from Java 11 to Java 17, I'm encountering compilation errors related to Lombok's @FieldNameConstants annotation. I'm also using MapStruct, so I'm mentioning that in case that could be ...
0
votes
1
answer
52
views
How to Convert Car to CarDTO using MapStruct Spring Extensions 1.1.3?
I think MapStruct great for conversion Entity to DTO.
I would like to use the new MapStruct Spring Extensions 1.1.3 to do this task but I think the documentation confusing.
So, how to use MapStruct ...
0
votes
0
answers
73
views
error: Qualifier error. No method found annotated with @Named#value:mapClientInformation
I am trying to migrate our API to Java 17 and Spring 6.2x version and I have some issue with the MapStruct. The qualifiedByName is recognized for some and other result in following error:
error: ...
0
votes
0
answers
61
views
Hibernate Child Collection unique constraint exception
I have Employee entity with pk emp_id. Employee has child collection as EmployeeLeaves (table emp_leaves). It has id, emp_id, leave_date, comment field.
I have @OneToMany(cascade = CascadeType.ALL, ...
3
votes
1
answer
208
views
Why does Map Struct sometimes generate the wrong mapper, and how can I fix it?
I'm using Java 8, Spring Boot 2.3.4.RELEASE version, Maven as the build tool and IntelliJ as my IDE.
I have two DTO's called VehicleMasterDto and VehicleDetailDto
Using MapStruct, I created the ...
1
vote
0
answers
132
views
MapStruct generated classes compile with errors in multi-module Maven project
I have a Maven multi-module project (repo), following hexagonal arquitecture, with the following structure:
parent
├─ domain (Lombok)
├─ app (Lombok)
└─ infra ...
2
votes
1
answer
184
views
SpringBootTest context with mapstruct.Mapper bean
I'm working in an application where I need to map some input to an entity class and I'm using mapstruct like this:
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct....