在我的DAO中导入实体时弹出Selma映射问题?

时间:2019-04-21 14:05:15

标签: java spring-boot mapping

我遇到了问题,我的构建失败了,所以我想做的是从dao到表中插入数据,所以这是我的java实体代码:

@Entity
@Table(name = "declaration_type", uniqueConstraints = 
@UniqueConstraint(columnNames = { "declaration_id", "type_id" }))
@Getter @Setter
public class DeclarationTypeEntity implements Serializable {

   private static final long serialVersionUID = 5424823478701291072L;

   @EmbeddedId
   @AttributeOverrides({
        @AttributeOverride(name = "declarationId", column = @Column(name = "declaration_id", nullable = false)),
        @AttributeOverride(name = "typeId", column = @Column(name = "type_id", nullable = false)) })
   private DeclarationTypeId id;

   @Column(name = "declaration_id", insertable = false, updatable = false)
   private Long declarationId;

   @Column(name = "type_id", insertable = false, updatable = false)
   private Long typeId;

   public DeclarationTypeEntity(Long dec, Long type) {
    this.declarationId = dec;
    this.typeId= type;
   }

}

这是我导入实体的位置,因此可以使用它:

package com.apicil.cosy.contrat.dao.api.hibernate.impl;

// other importations here .. but this one is causing the problem
import com.apicil.cosy.common.domain.contrat.DeclarationTypeEntity;

@Repository
public class TypesContratDaoImpl extends AbstractDaoImpl<Object, Long> implements TypesContratDao  {

   @Autowired
   private TypesContratDaoJPA typesContratDaoJPA;
   @Autowired 
   private DeclarationTypeDaoJPA declarationTypeDaoJPA;

   @SuppressWarnings({ "unchecked", "rawtypes" })
   @Override
   public CrudRepository getCrudRepositoryImpl() {
    // TODO Auto-generated method stub
    return null;
   }

   @Override
   public List<Type> getTypesContratDao() {
    // TODO Auto-generated method stub
    return getJPAQueryFactory().selectFrom(QType.type).fetch();
   }

   public void getTypesByDeclaration() {

   }

   public void ajouterUnTypeAuContrat() {
    declarationTypeDaoJPA.save(new DeclarationTypeEntity(1,5));
   }

   public void supprimerUnTypeDeContrat() {

   }


}

当我从dao类中删除DeclarationTypeEntity时,构建成功,这是我得到的错误:

Failed to generate mapping method for type com.apicil.cosy.common.domain.contrat.DeclarationTypeEntity to com.apicil.cosy.common.domain.contrat.DeclarationTypeEntity not supported on com.apicil.cosy.generateur.service.api.DocumentMappingHandler.clonnerLeDocument(com.apicil.cosy.generateur.domain.Document) !
[ERROR]   --> Add a custom mapper or 'withIgnoreFields' on @Mapper or @Maps to fix this ! If you think this a Bug in Selma please report issue here [https://github.com/xebia-france/selma/issues].

我不知道如何解决它,我花了太多时间,我是Spring Boot的新手,希望我能得到一些帮助,谢谢。

0 个答案:

没有答案