0

I am trying to generate code using Jhipster. Below is my JDL and it contains entity to generate JPA entity and also DTO. DTO is generated based on the given entity. Here is my problem. I need some extra fields in DTO but those are not required in generated entity class.

Basically I can achieve this in two way

  1. Edit generated DTO class and add required attributes

  2. Extend the generated DTO and add required new attributes.

Do we have any other way to achieve this ? like using some annotation I can say this attribute needed only in DTO and it is not required in Entity. Editing generated code is not allowed in the project so cannot use that approach.

@service(serviceImpl)
@dto(mapstruct)
entity EmployeeMaster(empl_mst){
 empNumber Long required
 empName String required
 age Integer required
 gender String required
 effectiveFromDate LocalDate required
 effectiveToDate LocalDate required
 department String required
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.