title: JPA EntityManagerFactory with AbstractRoutingDataSource containing multiple DB vendors?
body: <p>So I have a perfectly good working example of using AbstractRoutingDataSource and JdbcTemplate with Oracle / Sybase &amp; MsSql databases in the same running spring boot application.  I use AOP and a custom annotation on the method so that it sets the data source name on the thread and then the AbstractDataSource hands the correct data source to JdbcTemplate when you run a query.</p>
  <p>Now the issue I am facing, is how I go about configuring the hibernate dialects when configuring the EntityManagerFactoryBuilder, as these are obviously different and based on the underlying active data sources (can differ between environments).  The code  you would use to configure the EntityManagerFactory if all data sources were the same would be as follows.</p>
  <pre><code>@Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) {
  return builder
      .dataSource(dataSource)
      .packages(&quot;&lt;the associated entity package name&gt;&quot;)
      .build();
  </code></pre>
  <p>But when I start the spring boot application, I get the error below</p>
  <pre><code>Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
  </code></pre>
  <p>Anyone know a workaround for this or is it not possible to have the same JPA Entities and CrudRepository instances spread across multiple datasources with different vendors?</p>