使Spring Data JPA与DataNucleus(GAE)一起使用(Spring Boot) [英] Making Spring Data JPA work with DataNucleus (GAE) (Spring Boot)

查看:97
本文介绍了使Spring Data JPA与DataNucleus(GAE)一起使用(Spring Boot)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring Data可以与Google App Engine一起使用的一些提示如下:

There are several hints that Spring Data works with Google App Engine like:

  • http://tommysiu.blogspot.com/2014/01/spring-data-on-gae-part-1.html
  • http://blog.eisele.net/2009/07/spring-300m3-on-google-appengine-with.html

许多示例不是"Spring Boot",因此我一直在尝试使用它进行改进.但是,我已经被这个错误困扰了好几天了:

Much of the examples are not "Spring Boot" so I've been trying to retrofit things with it. However, I've been stuck with this error for days and days:

[INFO] Caused by: java.lang.NullPointerException
[INFO]  at org.datanucleus.api.jpa.metamodel.SingularAttributeImpl.isVersion(SingularAttributeImpl.java:79)
[INFO]  at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.findVersionAttribute(JpaMetamodelEntityInformation.java:102)
[INFO]  at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:79)
[INFO]  at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65)
[INFO]  at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:149)
[INFO]  at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:88)
[INFO]  at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:68)
[INFO]  at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:158)
[INFO]  at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:224)
[INFO]  at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:210)
[INFO]  at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:92)
[INFO]  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$6.run(AbstractAutowireCapableBeanFactory.java:1602)
[INFO]  at java.security.AccessController.doPrivileged(Native Method)
[INFO]  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1599)
[INFO]  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
[INFO]  ... 40 more

在这里,我尝试将Spring Data JPA与DataNucleus/AppEngine结合使用:

Where, I'm trying to use Spring Data JPA with DataNucleus/AppEngine:

@Configuration
@ComponentScan
@EnableJpaRepositories
@EnableTransactionManagement
class JpaApplicationConfig {
    private static final Logger logger = Logger
            .getLogger(JpaApplicationConfig.class.getName());
    @Bean
    public EntityManagerFactory entityManagerFactory() {
        logger.info("Loading Entity Manager...");
        return Persistence
                .createEntityManagerFactory("transactions-optional");
    }

    @Bean
    public PlatformTransactionManager transactionManager() {
        logger.info("Loading Transaction Manager...");
        final JpaTransactionManager txManager = new JpaTransactionManager();
        txManager.setEntityManagerFactory(entityManagerFactory());
        return txManager;
    }
}

我已经测试了Persistence.createEntityManagerFactory("transactions-optional");,以查看应用程序是否可以使用此EMF持久存在,确实可以,因此,我确定此EMF可以正常工作.问题在于Spring Data JPA的接线",有人可以帮忙吗?

I've tested Persistence.createEntityManagerFactory("transactions-optional"); to see if the app can persist using this EMF, well, it does, so I am sure that this EMF works fine. The problem is the "wiring" up with the Spring Data JPA, can anybody help?

推荐答案

您的意思是这个问题 http://www.datanucleus.org/servlet/jira/browse/NUCJPA-250 因为这似乎已经很久以前解决了.显然,您必须获得一个适用于您的JPA提供程序版本的GAE版本.

Do you mean this issue http://www.datanucleus.org/servlet/jira/browse/NUCJPA-250 because that seems to have been fixed a long time ago. Obviously you then have to get a version of GAE that will work with that version of your JPA provider.

这篇关于使Spring Data JPA与DataNucleus(GAE)一起使用(Spring Boot)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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