title: org.hibernate.HibernateException: Missing table: all
body: <p>When I run project with help <code>Gradle</code>, I get exception:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class com.somepackage.Application: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: all
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:975)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:752)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
      at com.somepackage.Application.main(Application.java:27)
  Caused by: org.hibernate.HibernateException: Missing table: all
      at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1333)
      at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
  
  Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class com.somepackage.Application: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing table: all
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554)
      at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:525)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:975)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:752)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
      at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
      at com.somepackage.Application.main(Application.java:27)
  Caused by: org.hibernate.HibernateException: Missing table: all
      at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1333)
      at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
      at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:525)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
      at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152)
  </code></pre>
  
  <p>This project works great on a laptop of my colleague. Moreover, this code works for me:</p>
  
  <pre><code>public static void main(String[] args) throws SQLException, ClassNotFoundException 
  {
      Class.forName("com.mysql.jdbc.Driver");
  
      Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/database?characterEncoding=UTF-8", "login", "password");
  
      Statement stmt = conn.createStatement();
  
      String strSelect = "SELECT * FROM `database`.tbl";
      ResultSet rset = stmt.executeQuery(strSelect);
  
      while (rset.next()) {   
          String f = rset.getString("field");
          System.out.println(f);
      }
  }
  </code></pre>
  
  <p>Probably there is a problem in this code:</p>
  
  <pre><code>@Bean
  public DataSource dataSource() {
      SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
      dataSource.setDriverClass(com.mysql.jdbc.Driver.class);
      dataSource.setUsername("login");
      dataSource.setUrl("jdbc:mysql://localhost:3306/database?characterEncoding=UTF-8");
      dataSource.setPassword("password");
  
      return dataSource;
  }
  
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
      LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
      em.setDataSource(dataSource());
      //
      return em;
  }
  </code></pre>
  
  <p>P.S. My operating system is Windows 7. I start my IDE under administration rights.</p>
  
  <p>P.S.S. All tables are exist.</p>