mysqlspringhibernategradledialect

Hibernate Dialect for MySQL8


I am getting below error in Spring Application with Hibernate. I have just upgraded the database mysql version from 5.6 to 8.0. The Error is:

nested exception is org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.MySQL8Dialect

In my build.gredle file I have included the following:

dependencies {
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.11'
}

And in my applicationContext.xml file I have included the following:

<property name="hibernateProperties">
  <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQL8Dialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.jdbc.batch_size">20</prop>
  </props>
</property>

In my lib folder I have the connector also "mysql-connector-java-8.0.11.jar". I don't understand why the dialect is still missing. Please help. :)


Solution

  • I was using Hibernate v-3.3.0 which actually dose not support the specified dialect. The reference link of the specified hibernate version is (https://javadoc.io/doc/org.hibernate/hibernate-core/3.3.0.CR1/index.html). Thanks to M. Deinum(https://stackoverflow.com/users/2696260/m-deinum) for helping me finding the issue.