Springboot、JPA和Ignite
原因:org.springframework.data.mapping.PropertyReferenceException:找不到类型Person的属性保存 实体:Springboot、JPA和Ignite,jpa,spring-boot,spring-data,ignite,Jpa,Spring Boot,Spring Data,Ignite,原因:org.springframework.data.mapping.PropertyReferenceException:找不到类型Person的属性保存 实体: @Entity public class Person implements Serializable { /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue
@Entity
public class Person implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@QuerySqlField(index = true)
public Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
存储库
@Component
@RepositoryConfig(cacheName = "PersonCache")
@Repository
public interface PersonRepository extends IgniteRepository<Person, Long> {
@Override
List<Person> findAll();
@Override
Person findOne(Long id);
}
堆栈跟踪:
原因:
org.springframework.data.mapping.PropertyReferenceException:否
找到类型Person的属性保存!在
org.springframework.data.mapping.PropertyPath.(PropertyPath.java:77)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:329)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:309)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:272)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:243)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.query.parser.Part.(Part.java:76)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.query.parser.PartTree$OrPart.(PartTree.java:247)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:398)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.query.parser.PartTree$谓词(PartTree.java:378)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.query.parser.PartTree.(PartTree.java:86)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.jpa.repository.query.PartTreeJpaQuery.(PartTreeJpaQuery.java:64)
~[spring-data-jpa-1.11.3.RELEASE.jar:na]
org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:103)
~[spring-data-jpa-1.11.3.RELEASE.jar:na]
org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:214)
~[spring-data-jpa-1.11.3.RELEASE.jar:na]
org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77)
~[spring-data-jpa-1.11.3.RELEASE.jar:na]
org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor。(RepositoryFactorySupport.java:436)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:221)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertieSet(RepositoryFactoryBeanSupport.java:263)
~[spring-data-commons-1.13.1.RELEASE.jar:na]at
org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.AfterPropertieSet(JpaRepositoryFactoryBean.java:101)
~[spring-data-jpa-1.11.3.RELEASE.jar:na]
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]。。。16通用框架
省略
似乎您正试图使用IgniteRepository来处理JPA实体 我认为这两个人不可能结婚。SpringJPA阻止了试图将其转换为SQL的自定义方法的使用,即使没有,也无法工作
IgniteRepository不是为JPA设计的。为什么您觉得需要PersonRepository?你能在Github上分享整个复制机吗?
@Bean
public Ignite igniteInstance() {
IgniteConfiguration cfg = new IgniteConfiguration();
// Setting some custom name for the node.
cfg.setIgniteInstanceName("springDataNode");
// Enabling peer-class loading feature.
cfg.setPeerClassLoadingEnabled(true);
// Defining and creating a new cache to be used by Ignite Spring Data repository.
CacheConfiguration ccfg = new CacheConfiguration("PersonCache");
// Setting SQL schema for the cache.
ccfg.setIndexedTypes(Long.class, Person.class);
cfg.setCacheConfiguration(ccfg);
return Ignition.start(cfg);
}