Springboot、JPA 和 Ignite [英] Springboot, JPA and Ignite

查看:59
本文介绍了Springboot、JPA 和 Ignite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原因:org.springframework.data.mapping.PropertyReferenceException:未找到 Person 类型的属性保存!

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property save found for type Person!

实体:

   @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);

}

点燃配置:

 @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);
    }

堆栈跟踪:

原因:org.springframework.data.mapping.PropertyReferenceException:否找到类型 Person 的属性保存!在org.springframework.data.mapping.PropertyPath.(PropertyPath.java:77)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:329)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:309)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:272)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:243)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.repository.query.parser.Part.(Part.java:76)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.repository.query.parser.PartTree$OrPart.(PartTree.java:247)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.repository.query.parser.PartTree$Predicate.buildTree(PartTree.java:398)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.repository.query.parser.PartTree$Predicate.(PartTree.java:378)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.repository.query.parser.PartTree.(PartTree.java:86)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在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] 在org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:221)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263)~[spring-data-commons-1.13.1.RELEASE.jar:na] 在org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(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] 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE] ... 16个常用框架省略

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property save found for type Person! at 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$Predicate.(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] at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:103) ~[spring-data-jpa-1.11.3.RELEASE.jar:na] at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:214) ~[spring-data-jpa-1.11.3.RELEASE.jar:na] at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77) ~[spring-data-jpa-1.11.3.RELEASE.jar:na] at 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.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263) ~[spring-data-commons-1.13.1.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:101) ~[spring-data-jpa-1.11.3.RELEASE.jar:na] at 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 common frames omitted

推荐答案

您似乎正在尝试使用 IgniteRepository 来处理 JPA 实体.

It seems that you are trying to use IgniteRepository to work with a JPA entity.

我认为这两个人不可能结婚.Spring JPA 阻塞了 IgniteRepository 自定义方法,试图将它们转换为 SQL,即使没有,它仍然无法工作.

I don't think that it's possible to marry these two. Spring JPA chokes on IgniteRepository custom methods trying to convert them into SQL, and even if it didn't it would still not work.

IgniteRepository 并不是为 JPA 设计的.

IgniteRepository was just not designed for JPA.

这篇关于Springboot、JPA 和 Ignite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆