#Mapstruct generated soruce
1 messages · Page 1 of 1 (latest)
@indigo comet
Your question has been closed due to inactivity.
If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.
Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.
When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.
Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.
With enough info, someone knows the answer for sure 👍
No response
I'd try enhancing my question. Those screenshots are a challenge to read.
You can always add the actual generated code here.
My java class
import lombok.;
import javax.persistence.;
import java.util.Set;
@Entity
@Table(name = "AccountDomainList")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class AccountDomainListEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "AccountDomainListTId")
private int accountDomainListTId;
@Column(name = "PensionDossierListTId")
private Long pensionDossierListTId;
@Column(name = "DB2PDomainCode")
private String db2pDomainCode;
@Column(name = "SegmentCode")
private String segmentCode;
@Column(name = "AccountSigedisId")
private String accountSigedisId;
@ManyToOne
@JoinColumn(name = "pensionDossierListTId", referencedColumnName = "pensionDossierListTId", insertable = false, updatable = false)
private PensionDossierListEntity pensionDossierList;
@OneToMany(mappedBy = "accountDomainList", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private Set<RegistrantListEntity> registrantList;
}
SWAGGER GENERATED CLASS
@JsonTypeName("accountDomain")
@javax.annotation.Generated(value = "belfius.devtools.openapi.generator.BelfiusJavaServerGenerator", date = "2024-09-23T11:57:49.742291+02:00[Europe/Brussels]")
@belfius.devx.devtools.rest.ApiDefinition(id="", version="1.0.1")
public class AccountDomain {
@JsonProperty("pensionDossierListTId")
private Integer pensionDossierListTId;
@JsonProperty("db2pDomainCode")
private String db2pDomainCode;
@JsonProperty("accountDomainListTId")
private Integer accountDomainListTId;
@JsonProperty("segmentCode")
private String segmentCode;
@JsonProperty("accountSigedisId")
private Integer accountSigedisId;
public AccountDomain pensionDossierListTId(Integer pensionDossierListTId) {
this.pensionDossierListTId = pensionDossierListTId;
return this;
}
MAPSTRUCT MAPPER
@Mapper(componentModel = "spring")
public interface AccountDomainListMapper {
@Mapping(source = "accountDomainListTId", target = "accountDomainListTId")
@Mapping(source = "pensionDossierListTId", target = "pensionDossierListTId")
@Mapping(source = "db2pDomainCode", target = "db2pDomainCode")
@Mapping(source = "segmentCode", target = "segmentCode")
@Mapping(source = "accountSigedisId", target = "accountSigedisId")
@Mapping(target = "pensionDossierList", ignore = true)
@Mapping(target = "registrantList", ignore = true)
AccountDomainListEntity toAccountDomainEntity(AccountDomain accountDomain);
@InheritInverseConfiguration
AccountDomain toAccountDomainModel(AccountDomainListEntity accountDomainListEntity);
}
AND THIS IS THE Mapper genereatedsources
like you can see there are a lot of errors
thank you for helping me out
you will have to configure annotationProcessorPaths https://springframework.guru/using-mapstruct-with-project-lombok/
and you need the lombok-mapstruct-binding 🙂
e.g.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</dependency>
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=spring
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
Thank you for the answer but it worked ive closed the post but i don’t now why it’s is still open
You can use: /help-thread close.