I have a problem using MAPSTRUCT. I created a record that has an id of type long and in my mapper I need to convert this object to the Long type, but the error below occurs. I will leave the code to make the problem clearer, sorry if any information is missing, it’s my first question on the forum.
Ambiguous constructors found for creating java.lang.Long: Long(long), Long(java.lang.String). Either declare parameterless constructor or annotate the default constructor with an annotation named @Default.
My code:
IdClient.java
public record IdClient(Long id) { }
ClientEntity.java
@Table(name = "client") @Builder
public record ClientEntity(Long idClient){}
ClientMapper.java
@ApplicationScoped public interface ClientMapper {
ClientEntity IdClientToClientEntity(IdClient id);
Long map(IdClient id);
}
Rodrigo Monterio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.