我正在使用java-play-spring模板(可在此处获取:https://github.com/jamesward/play-java-spring#master),目前我正在尝试为它编写一些演变。
我正在写我的剧本:
# --- !Ups
CREATE TABLE accounts
(
accountid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
clientid INT NOT NULL,
credit DECIMAL(13,2)
);
# --- !Downs
drop table accounts;
进入conf / evolutions / default / 1.sql。不幸的是,申请开始后,没有任何反应。我想它可能是Spring / Hibernate错误,所以我禁用了Hibernate验证:
@Configuration
@EnableTransactionManagement
public class DataConfig {
@Bean
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(true);
vendorAdapter.setGenerateDdl(false);
LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
entityManagerFactory.setPackagesToScan("models");
entityManagerFactory.setJpaVendorAdapter(vendorAdapter);
entityManagerFactory.setDataSource(dataSource());
entityManagerFactory.setValidationMode(ValidationMode.NONE);
entityManagerFactory.afterPropertiesSet();
return entityManagerFactory.getObject();
}
@Bean
public PlatformTransactionManager transactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager(entityManagerFactory());
return transactionManager;
}
@Bean
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(Play.application().configuration().getString("db.default.driver"));
dataSource.setUrl(Play.application().configuration().getString("db.default.url"));
dataSource.setUsername(Play.application().configuration().getString("db.default.user"));
dataSource.setPassword(Play.application().configuration().getString("db.default.password"));
return dataSource;
}
}
但这并没有帮助。我还添加了
play.modules.evolutions.enabled=true
到我的application.conf。这也没有用。
有没有人有任何想法可能出错?