Ignite CrudRepository仍然为deleteAll发生名称冲突

时间:2019-05-22 05:57:45

标签: spring-boot spring-data ignite spring-data-ignite

我使用ignite核心,并且ignite-spring-data都为2.7.0

 compile "org.apache.ignite:ignite-core:2.7.0"
 compile "org.apache.ignite:ignite-spring-data:2.7.0"
 compile('org.springframework.boot:spring-boot-starter-jdbc:2.1.5.RELEASE');

但是我仍然收到此错误:

error: name clash: deleteAll(Iterable<? extends T>) in CrudRepository and deleteAll(Iterable<ID>) in IgniteRepository have the  same erasure, yet neither overrides the other
where T,ID are type-variables:
T extends Object declared in interface CrudRepository
ID extends Serializable declared in interface IgniteRepository

根据https://issues.apache.org/jira/browse/IGNITE-6879,此问题在2.7.0版中已解决,为什么我仍然可以得到它?

如果我改用:

  compile "org.apache.ignite:ignite-spring-data_2.0:2.7.0"

似乎一切都破了,所以我不确定是否有选择。

import org.apache.ignite.springdata.repository.IgniteRepository;
import org.apache.ignite.springdata.repository.config.Query;
import org.apache.ignite.springdata.repository.config.RepositoryConfig;


@RepositoryConfig(cacheName = "PersonCache")
public interface PersonRepository extends IgniteRepository<Person, Long> {

 List<Person> findByFirstNameAndLastName(String firstName, String lastName);

 @Query("SELECT c.* FROM Person p JOIN \"ContactCache\".Contact c ON p.id=c.personId WHERE p.firstName=? and p.lastName=?")
List<Contact> selectContacts(String firstName, String lastName);

 @Query("SELECT p.id, p.firstName, p.lastName, c.id, c.type, c.location FROM Person p JOIN \"ContactCache\".Contact c ON p.id=c.personId WHERE p.firstName=? and p.lastName=?")
List<List<?>> selectContacts2(String firstName, String lastName);
}

2 个答案:

答案 0 :(得分:1)

只需切换到点燃弹簧数据的新2.0支持版本即可。

compile "org.apache.ignite:ignite-spring-data_2.0:${igniteVersion}"

import org.apache.ignite.springdata20.repository.IgniteRepository;
import org.apache.ignite.springdata20.repository.config.Query;
import org.apache.ignite.springdata20.repository.config.RepositoryConfig;

不用担心!

答案 1 :(得分:0)

更改为使用后:

<dependency>
        <groupId>org.apache.ignite</groupId>
        <artifactId>ignite-spring-data_2.0</artifactId>
        <version>${ignite.version}</version>
    </dependency>

.....

<ignite.version>2.7.0</ignite.version>

您将不得不重新导入所有内容。因此,只需将代码中的“导入”部分全部删除即可。从现在开始,IgniteRepository等来自一个名为org.apache.ignite.springdata20.repository ....的程序包,而不是旧程序包。