I'm trying to run a SpringBoot application but it is failing due to a Hibernate validation:
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)
I do know this is happening due to the Hibernate validation (it works when I disable it), however, the error doesn't make sense to me as the table does exist on my database (Mysql 5.7)
Any help would be appreciated.
Update 1:
I'm mapping my entity with annotations:
@Entity
@Table(name = "TABLE", catalog = "SCHEMA", schema = "")
while my persistence configuration file is quite simple:
@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;
}