title: Spring hibernate does not create mysql tables
body: <p>I am implementing a backend with two database connections. One to a MS Access DB and another one to a MySQL DB. I've setup two configuration classes and the <strong>application is running without any error</strong> message, but does <strong>not create the tables for my entities in mysql</strong> db.</p>
  <p>Project structure:</p>
  <pre><code>my.backend
    |
    --&gt; configuration
    --&gt; controller
    --&gt; exceptions
    --&gt; model
    | |
    | --&gt; mysql
    | --&gt; msaccess
    |
    --&gt; repo
    | |
    | --&gt; mysql
    | --&gt; msaccess
    |
    --&gt; service
  </code></pre>
  <p>My configuration files are looking like this:
  MySQL Configuration:</p>
  <pre><code>imports [...]
  
  @Configuration
  @EnableJpaRepositories(
          entityManagerFactoryRef = &quot;mysqlEntityManagerFactory&quot;,
          transactionManagerRef = &quot;mysqlTransactionManager&quot;,
          basePackages = &quot;my.backend.repo.mysql&quot;
  )
  public class MySqlJpaConfig {
      @Autowired
      private Environment env;
  
      @Bean
      @Primary
      @ConfigurationProperties(prefix = &quot;mysql&quot;)
      public LocalContainerEntityManagerFactoryBean mysqlEntityManagerFactory() {
          LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
          em.setDataSource(mysqlDataSource());
          em.setPackagesToScan(&quot;my.backend.model.mysql&quot;);
          em.setPersistenceUnitName(&quot;mysql&quot;);
          em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
  
          HashMap&lt;String, Object&gt; jpaProperties = new HashMap&lt;&gt;();
          jpaProperties.put(&quot;hibernate.ddl-auto&quot;,
                  env.getProperty(&quot;mysql.jpa.hibernate.ddl-auto&quot;));
          jpaProperties.put(&quot;hibernate.dialect&quot;,
                  env.getProperty(&quot;mysql.jpa.properties.hibernate.dialect&quot;));
          em.setJpaPropertyMap(jpaProperties);
  
          return em;
      }
  
      @Primary
      @Bean
      public DataSource mysqlDataSource() {
  
          DriverManagerDataSource dataSource
                  = new DriverManagerDataSource();
          dataSource.setUrl(env.getProperty(&quot;mysql.url&quot;));
          dataSource.setUsername(env.getProperty(&quot;mysql.username&quot;));
          dataSource.setPassword(env.getProperty(&quot;mysql.password&quot;));
          dataSource.setDriverClassName(Objects.requireNonNull(env.getProperty(&quot;mysql.driver-class-name&quot;)));
  
          return dataSource;
      }
  
      @Primary
      @Bean
      public PlatformTransactionManager mysqlTransactionManager() {
  
          JpaTransactionManager transactionManager
                  = new JpaTransactionManager();
          transactionManager.setEntityManagerFactory(
                  mysqlEntityManagerFactory().getObject());
          return transactionManager;
      }
  }
  
  </code></pre>
  <p>MS Access Configuration:</p>
  <pre><code>@Configuration
  @EnableJpaRepositories(
          entityManagerFactoryRef = &quot;msaccessEntityManagerFactory&quot;,
          transactionManagerRef = &quot;msaccessTransactionManager&quot;,
          basePackages = &quot;my.backend.repo.msaccess&quot;
  )
  @EnableTransactionManagement
  public class MsAccessJpaConfig {
      @Autowired
      private Environment env;
  
      @Bean
      @ConfigurationProperties(prefix = &quot;mysql&quot;)
      public LocalContainerEntityManagerFactoryBean msaccessEntityManagerFactory() {
          LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
          em.setDataSource(msaccessDataSource());
          em.setPackagesToScan(&quot;my.backend.model.msaccess&quot;);
          em.setPersistenceUnitName(&quot;msaccess&quot;);
          //em.setPersistenceProvider(new HibernatePersistenceProvider());
          em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
  
          HashMap&lt;String, Object&gt; jpaProperties = new HashMap&lt;&gt;();
          jpaProperties.put(&quot;hibernate.dialect&quot;,
                  env.getProperty(&quot;msaccess.jpa.properties.hibernate.dialect&quot;));
          em.setJpaPropertyMap(jpaProperties);
          return em;
      }
  
      @Bean
      public DataSource msaccessDataSource() {
  
          DriverManagerDataSource dataSource
                  = new DriverManagerDataSource();
          dataSource.setUrl(env.getProperty(&quot;msaccess.url&quot;));
          dataSource.setDriverClassName(Objects.requireNonNull(env.getProperty(&quot;msaccess.driver-class-name&quot;)));
  
          return dataSource;
      }
  
      @Bean
      public PlatformTransactionManager msaccessTransactionManager() {
  
          JpaTransactionManager transactionManager
                  = new JpaTransactionManager();
          transactionManager.setEntityManagerFactory(
                  msaccessEntityManagerFactory().getObject());
          return transactionManager;
      }
  
  }
  </code></pre>
  <p>And my application.properties file:</p>
  <pre><code>spring.jpa.show-sql=true
  spring.jpa.open-in-view=false
  # MySQL config
  mysql.url=jdbc:mysql://localhost:3306/my_database
  mysql.username=
  mysql.password=
  mysql.driver-class-name=com.mysql.cj.jdbc.Driver
  mysql.jpa.hibernate.ddl-auto=update
  mysql.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
  # MS Access config
  msaccess.url=jdbc:ucanaccess://c:/users/username/documents/test.accdb
  msaccess.driver-class-name=net.ucanaccess.jdbc.UcanaccessDriver
  msaccess.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServerDialect
  </code></pre>
  <p>When I run my application without the custom configuration and only one vanilla database connection (only MySQL) everything works fine. Also if I run this and perform a get request I get a Error that the table does not exist (obviously), so the connection to MySQL is there but the application just does not create the tables I need. Btw MS Access is working the same way, but I do not want a table generation there.</p>
  <p>Am I missing some configuration for the connection?</p>
  <p>Thanks for your help!
  Cheers, niklas</p>