We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generating the app with Mapstruct leads to wrong mappings for some entitites. Which in turn leads to compiler errors.
application { config { baseName sample packageName sample applicationType microservice authenticationType oauth2 serverPort 8081 buildTool gradle cacheProvider no clientFramework no databaseType sql prodDatabaseType postgresql devDatabaseType postgresql serviceDiscoveryType no enableTranslation false messageBroker kafka skipClient true skipUserManagement true } entities * dto * with mapstruct } entity ParentEntity { parentRequiredField String required } entity ChildEntity { childField String } relationship ManyToOne { ChildEntity{user(login) required} to User } relationship OneToMany { ParentEntity{child} to ChildEntity{parent(parentRequiredField) required} }
Generating with the above JDL produces the following Mapper:
@Mapper(componentModel = "spring") interface ChildEntityMapper : EntityMapper<ChildEntityDTO, ChildEntity> { @Mappings( Mapping(target = "user", source = "user", qualifiedByName = ["userLogin"]), Mapping(target = "parent", source = "parent", qualifiedByName = ["parentEntityParentRequiredField"]) ) override fun toDto(s: ChildEntity): ChildEntityDTO @Named("userLogin") @BeanMapping(ignoreByDefault = true) @Mappings( Mapping(target = "id", source = "id"), Mapping(target = "login", source = "login") ) fun toDtoUserLogin(user: User): UserDTO @Named("parentEntityParentRequiredField") @BeanMapping(ignoreByDefault = true) @Mappings( Mapping(target = "id", source = "id"), Mapping(target = "login", source = "login"), Mapping(target = "parentRequiredField", source = "parentRequiredField") ) fun toDtoParentEntityParentRequiredField(parentEntity: ParentEntity): ParentEntityDTO }
The last function toDtoParentEntityParentRequiredField has a mapping annotation for the login field. But the parent entity does not have this field.
toDtoParentEntityParentRequiredField
login
v1.16.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Overview of the issue
Generating the app with Mapstruct leads to wrong mappings for some entitites. Which in turn leads to compiler errors.
Reproduce the error
JDL
Generating with the above JDL produces the following Mapper:
ChildEntityMapper
The last function
toDtoParentEntityParentRequiredField
has a mapping annotation for thelogin
field. But the parent entity does not have this field.KHipster Version(s)
v1.16.0
The text was updated successfully, but these errors were encountered: