1,599 questions
0
votes
1
answer
68
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
97
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
29
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
61
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
121
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
154
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
51
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
67
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
60
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
191
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
112
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
151
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....
0
votes
0
answers
40
views
Mapstruct @SubMapping with multiple parameters
I'm trying to map Phone, Book to PhoneDto, BookDto using ItemMapper with @SubclassMapping in Mapstruct.
The issue is during subclass mapping, the second parameter String imagePath gets ignored.
I ...
-2
votes
1
answer
99
views
ClassNotFoundException for Generated Mapper Interface
I'm experiencing a ClassNotFoundException: AccountMapper when trying to integrate MapStruct with Spring Boot 3.5.4. The MapStruct annotation processor generates the implementation class correctly, but ...
1
vote
1
answer
65
views
Mapstruct - Generic Mapper and default value for null
I have several DTOResponse class, each one of them extending MiniDTOResponse.
@Data
@NoArgsConstructor
public class MiniDTOResponse extends EmptyDTOResponse {
private boolean exists;
}
@Data
...