title: Spring Boot, JPA, and MySQL 8 Dialect Errors
body: <p>I have a Spring Boot 2.4.5 application (latest version at this time).  Spring Boot Data JPA has Hibernate 5.4.30.Final which is nearly the latest, and MySQL 8.   This was an older version of Spring Boot which used Hibernate 5 and used Junit 4, and it was working correctly.   I decided to update all my libraries to the latest libraries and everything broke.   So, now I am putting my application back together with the latest libraries and running into a few issues.   Most of those issues I was able to resolve, but this one hasn't been resolved yet, and that's why I came here.</p>
  <p>I have the following configurations:</p>
  <p>Maven MySQL Dependency:</p>
  <pre><code>    &lt;groupId&gt;mysql&lt;/groupId&gt;&lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;&lt;version&gt;8.0.24&lt;/version&gt;
  </code></pre>
  <p>The application.properties file has the following:</p>
  <pre><code>spring.datasource.url=jdbc:mysql://localhost:3306/phonebook
  spring.datasource.username=username
  spring.datasource.password=password
  spring.datasource.driverClassName=com.mysql.jdbc.Driver
  spring.jpa.database-platform=org.hibernate.dialect
  spring.jpa.show-sql=true
  spring.jpa.hibernate.ddl-auto=none
  spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
  spring.jpa.properties.hibernate.dialect.storage_engine=innodb
  spring.data.jpa.repositories.enabled=true
  </code></pre>
  <p>My Configuration File looks like:</p>
  <pre><code>@Configuration
  @ComponentScan(basePackages =
  { &quot;com.tomholmes.springboot.phonebook.server&quot; })
  @PropertySource(value = &quot;classpath:application.properties&quot;)
  @EntityScan(&quot;com.tomholmes.springboot.phonebook.server.domain&quot;)  
  @EnableJpaRepositories(basePackages = &quot;com.tomholmes.springboot.phonebook.server.dao&quot;)
  public class RepositoryContextConfiguration
  {
      @Bean(name = &quot;entityManagerFactory&quot;)
      public LocalSessionFactoryBean sessionFactory()
      {
          LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
          return sessionFactory;
      }
  }
  </code></pre>
  <p>My Test Case looks like this below, and you should know that I am using the JUnit 5 jupiter.test classes.</p>
  <pre><code>@ExtendWith(SpringExtension.class)
  @SpringBootTest(classes = RepositoryContextConfiguration.class)
  @ComponentScan(&quot;com.tomholmes.springboot.phonebook.server&quot;)
  @Transactional
  public class BaseDaoTests
  {
        @Autowired UserDao userDao;
  
        @Test
        public void testGetUserById()  {
              UserEntity userEntity = userDao.findById(1L);
        }
  }
  </code></pre>
  <p>Whenever I run my unit test, I get this error:</p>
  <pre><code>Caused by: org.hibernate.HibernateException: 
       Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
  </code></pre>
  <p>So obviously, I went to Google and I put this into the search.   It came back with a lot of hits, but mostly from StackOverflow.  So, I spent my morning pouring over the answers already posted here, and some other places on the internet as well.   Some people solved their solution, but it was older versions of Hibernate, or Spring or Spring Boot, so none of those seemed to fit.  I am hoping this is a small fix, and once I get past this log-jam, then I think the rest of my code will flow easier.</p>
  <p>Thanks for any help, and if there is anything else you'd like me to post, let me know.  Thanks again!</p>
  <p>FYI:  I have a Spring 5.3.6 Application with Hibernate 5.4.31.Final and JUnit 4.  This application talks to the same database.  Same tables, same localhost, same port, same user who has the correct positions, etc., so I know the database is running and the tables match the entities.</p>