0

I upgraded from Spring Boot v.1.5.8 to v.2.1.5. When I try to start the application I get the following error:

IllegalArgumentException: Fragment implementation .OtmUniParentRepository2019GeneratedImpl$$EnhancerBySpringCGLIB$$cdf9e294 does not implement x.OtmUniParentRepository2019Generated!

Why I can't start it anymore?

The files:

OtoUniChildRepository2019

@RepositoryRestResource(collectionResourceRel = "OtoUniChild2019", path = "OtoUniChild2019")
public interface OtoUniChildRepository2019 extends OtoUniChildRepository2019Generated {

}

@Transactional
class OtoUniChildRepository2019Impl extends HeartcoreRepositoryImpl<OtoUniChild> {

    @PostConstruct
    private void setIni() {
        super.setIni(OtoUniChild.TABLENAME, OtoUniChild.getColumnName(), OtoUniChild.class, "AGRIDB2019");
    }

}

OtoUniChildRepository2019Generated

public interface OtoUniChildRepository2019Generated extends HeartcoreRepository<OtoUniChild>  {


    OtoUniChild findByIdAndOtoUniParentIsNotNull(@Param("id") String id);

    OtoUniChild findByOtoUniParentId(@Param("id") String id);

}

@Transactional
class OtoUniChildRepository2019GeneratedImpl extends HeartcoreRepositoryImpl<OtoUniChild> {

    @PostConstruct
    private void setIni() {
        super.setIni(OtoUniChild.TABLENAME, OtoUniChild.getColumnName(), OtoUniChild.class, "AGRIDB2019");
    }

}

HeartcoreRepository

@NoRepositoryBean
public interface HeartcoreRepository<T extends Heartcore> extends RevisionRepository<T, String, Integer>, PagingAndSortingRepository<T, String>, HeartcoreCustomRepository<T> {

    @Override
    T findOne(String id);

    boolean existsById(String id);

    @Override
    Collection<T> findAll();

    List<T> findAllByKanton(@Param("kanton") String kanton);
}

HeartcoreCustomRepository

public interface HeartcoreCustomRepository<T extends Heartcore> {

    List<T> findCustom(String sqlQuery);

    List<T> findCustom(String select, String where);

    Class<T> getType();

    T findOne(String id);

    Collection<T> findAll();

     String getSequence(String sequenceName);
}

HeartcoreCustomRepositoryImpl

@Transactional
public class HeartcoreRepositoryImpl<T extends Heartcore> implements HeartcoreCustomRepository<T> {

    @PersistenceContext
    protected EntityManager entityManager;

    // irrelevant code

    public void setIni(String tablename, List<String> columns, Class<T> type, String schema) {
        this.tablename = tablename;
        this.columns = columns;
        this.type = type;
        this.schema = schema;

        MultitenantDataSource multitenantDataSource = (MultitenantDataSource) entityManager.getEntityManagerFactory().getProperties().get("hibernate.connection.datasource");
        DataSource dataSource = (DataSource) multitenantDataSource.determineTargetDataSource();
        try {
            this.dbDriver = dataSource.getConnection().getMetaData().getDriverName();
        }
        catch (SQLException e) {
            e.printStackTrace();
        }
    }

// irrelevant code

With 1.5.8 it works fine and I couldn't find infos about breaking changes.

EDIT: Is something wrong with this inheritance structure of the repositories? I tried some different approaches but none worked. Is there an other way to implement some basic functionality for repositories?

Sven M.
  • 587
  • 7
  • 23

0 Answers0