Skip to content
New issue

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

Using inheritance with interfaces not working #199

Open
eapereira opened this issue Jul 4, 2018 · 0 comments
Open

Using inheritance with interfaces not working #199

eapereira opened this issue Jul 4, 2018 · 0 comments

Comments

@eapereira
Copy link

eapereira commented Jul 4, 2018

Hello I trying to make some tests with Selma, but unfortunately its not working to my extended interfaces with generic methods.

Here is some code:

public interface AbstractMapper<SOURCE extends AbstractDomain, TARGET extends AbstractDomain> {

	TARGET copyProperties(SOURCE source, TARGET target);

	List<SOURCE> copyPropertiesList(List<SOURCE> sources, List<SOURCE> targets);

	TARGET copyProperties(SOURCE source);

}

@Mapper(withCyclicMapping = true, withCustom = UserMapper.class)
public interface UserMapper extends AbstractMapper<User, UserEntity> {
	UserMapper INSTANCE = Selma.builder(UserMapper.class).build();
}

@Mapper(
		withCyclicMapping = true,
		withCustomFields = {
				@Field(value = "user", withCustom = UserMapper.class) })
public interface RegraValorMapper
		extends AbstractMapper<RegraValor, RegraValorEntity> {
	RegraValorMapper INSTANCE = Selma.builder(RegraValorMapper.class).build();
}

//Classes

@Entity
@Table(name = "TB_REGRA_VALOR")
@NamedQuery(
		name = "RegraValorEntity.findAll",
		query = "SELECT r FROM RegraValorEntity r")
public class RegraValorEntity extends RegraValor {

	/**
	 * 
	 */
	private static final long serialVersionUID = -11198378234826917L;

	public RegraValorEntity() {
	}

	public RegraValorEntity(RegraValorUi ui) {
		super(ui);
	}

	@Column(name = "VL_REGRA_VALOR")
	public BigDecimal getValor() {
		return super.getValor();
	}

	// bi-directional many-to-one association to RegraOperation
	@ManyToOne(
			fetch = FetchType.LAZY,
			targetEntity = RegraOperationEntity.class)
	@JoinColumn(name = "ID_REGRA_OPERATION")
	public RegraOperation getRegraOperation() {
		return super.getRegraOperation();
	}

	@Override
	protected void copyProperties(AbstractDomain abstractDomain) {
		RegraValorMapper.INSTANCE
				.copyProperties((RegraValorUi) abstractDomain, this);
	}

}

public abstract class RegraValor extends AbstractDomain {
	private static final long serialVersionUID = 1L;

	private BigDecimal valor;
	private RegraOperation regraOperation;

	public RegraValor() {
	}

	public RegraValor(RegraValor entity) {
		super(entity);
	}

	public BigDecimal getValor() {
		return this.valor;
	}

	public void setValor(BigDecimal vlRegraValor) {
		this.valor = vlRegraValor;
	}

	public RegraOperation getRegraOperation() {
		return this.regraOperation;
	}

	public void setRegraOperation(RegraOperation regraOperation) {
		this.regraOperation = regraOperation;
	}

}

Error message:

ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project CoParticipacaoJPA: Compilation failure
[ERROR] /home/eapereira/desenv/git-home/coparticipacao/CoParticipacaoJPA/src/br/com/spread/qualicorp/wso2/coparticipacao/domain/mapper/entity/UserMapper.java:[15,8] No valid mapping method found in custom selma class br.com.spread.qualicorp.wso2.coparticipacao.domain.mapper.entity.UserMapper\n A custom mapping method is public and returns a type not void, it takes one parameter or more if you specified datasource.
[ERROR] -> [Help 1]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant