Making Spring Data JPA work with DataNucleus (GAE) (Spring Boot)

Posted by xybrek on Stack Overflow See other posts from Stack Overflow or by xybrek
Published on 2014-06-09T08:46:38Z Indexed on 2014/06/09 9:25 UTC
Read the original article Hit count: 477

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

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

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

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about spring