Reputation: 1
I have an entity class in a Quarkus project that extends PanacheEntity from Hibernate with Panache.I want to keep my fields private and use Lombok's @Data annotation to automatically generate getters and setters. However, when I use MapStruct to map to this entity, it seems unable to find the setters, and the generated implementation does not populate the fields.
When I run the project (e.g., with quarkus dev
or mvn clean install
), MapStruct generates the following implementation:
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "...",
comments = "..."
)
@ApplicationScoped
public class MyObjMapperImpl implements MyObjMapper {
@Override
public MyObj toMyObj(MyReq req) {
if (req == null) {
return null;
}
MyObj myObj = new MyObj();
// Fields are not set here
return myObj;
}
}
@Entity
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Table(name = "MyObj")
public class MyObj extends PanacheEntity {
@NotNull
private String name;
private String z;
@NotNull
@Min(value = 1)
private Double x;
private Double y;
}
How can I configure MapStruct to work with Lombok @Data
in this context?
Any guidance would be greatly appreciated. Thank you!
Upvotes: 0
Views: 30