我相信我有正确的组合datanucleus-appengine和datanucleus罐子:
2.1:需要DataNucleus 3.1.x(core,api-jdo,api-jpa,enhancer)。需要SDK 1.6.4+请注意,DataNucleus项目不再支持此版本的Datanucleus
JPA App配置:
@Configuration
@EnableJpaRepositories("demo.core.entity")
@EnableTransactionManagement
class JpaApplicationConfig {
private static final Logger logger = Logger
.getLogger(JpaApplicationConfig.class.getName());
@Bean
public AbstractEntityManagerFactoryBean entityManagerFactory() {
logger.info("Loading Entity Manager...");
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setPersistenceUnitName("transactions-optional");
return factory;
}
@Bean
public PlatformTransactionManager transactionManager() {
logger.info("Loading Transaction Manager...");
JpaTransactionManager txManager = new JpaTransactionManager();
txManager.setEntityManagerFactory(entityManagerFactory().getObject());
return txManager;
}
@Bean
public PersistenceExceptionTranslator persistenceExceptionTranslator() {
return new OpenJpaDialect();
}
}
Application.java
@Configuration
@ComponentScan
@EnableAutoConfiguration
@RestController
public class Application {
private static final EntityManagerFactory INSTANCE =
Persistence.createEntityManagerFactory("transactions-optional");
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@RequestMapping("/")
public String home() {
return "Hello World";
}
}
繁华开满天机