0

I have the following embedabble

@Data
@Embeddable
public class BaseEntity {
  
  @CreatedDate
  @Column(name = "created_date")
  private LocalDateTime createdDate;

  @CreatedBy
  @Column(name = "created_by")
  private String createdBy;
}

Which I embed into my entity like so

@Entity
@Data
@NoArgsConstructor
@Table(name = "participant")
public class Participant {

  @Id
  @GeneratedValue
  private UUID id;

  @Embedded
  private BaseEntity baseEntity;
}

And in my mapper I want to access the embedded properties of the Participant like so

 @Mapping(target = "createdDate", source = "participant.createdDate")
  ParticipantDto entityToDto(Participant participant);

But I get the following error message

error: The type of parameter "participant" has no property named "createdDate".

As mapping source I tried participant.basicEntitity.createdDate which also results in the same error message as well as not specifying any mapping so mapstruct can automap, which also results in the property not found error message

JangoCG
  • 823
  • 10
  • 23

0 Answers0