我正在尝试运行SpringBoot应用程序,但是由于Hibernate验证而失败:
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing table [SCHEMA.TABLE]
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateTable(AbstractSchemaValidator.java:121)
at org.hibernate.tool.schema.internal.GroupedSchemaValidatorImpl.validateTables(GroupedSchemaValidatorImpl.java:42)
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.performValidation(AbstractSchemaValidator.java:89)
我确实知道这是由于Hibernate验证而发生的(当我禁用它时它可以工作),但是,由于我的数据库中确实存在该表(Mysql 5.7),因此该错误对我来说没有意义
任何帮助将不胜感激。
更新1:
我正在使用注释映射实体:
@Entity
@Table(name = "TABLE", catalog = "SCHEMA", schema = "")
我的持久性配置文件非常简单:
@Configuration
@EnableTransactionManagement
public class PersistenceConfig {
@Autowired
private DataSource dataSource;
@Bean
public LocalContainerEntityManagerFactoryBean getEntityManager() {
LocalContainerEntityManagerFactoryBean em
= new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setPackagesToScan(new String[] { "my.package" });
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}
Properties additionalProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "validate");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
return properties;
}