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
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?
Another workaround is to switch back to Spring Data 1.3.0.
And I recommend it, if you don't want to waste a day configuring Spring context and dependencies.
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.