0

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. :)

Shobuj
  • 47
  • 1
  • 7
  • 1
    The dialect is part of hibernate NOT the jdbc driver. There is no specific MySQL8 dialect. For a list of available dialects see https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#database-dialect – M. Deinum Jan 27 '20 at 07:40
  • M.Deinum, I have added the dialect by following this thread: (https://stackoverflow.com/questions/50322550/hibernate-dialect-for-mysql-8). By the way, the link you have shared there is no existence of **MySQL8Dialect** so can you please suggest which of the dialect should I use for **MySQL v-8** – Shobuj Jan 27 '20 at 07:53
  • The 5.7 one. The fact that there isn't a specific dialect, just use the latests. – M. Deinum Jan 27 '20 at 07:57
  • @M.Deinum, I have used the below line but still the same error **org.hibernate.dialect.MySQL57InnoDB** – Shobuj Jan 27 '20 at 08:37
  • check your hibernate version and see which dialects are available. Pick one. – M. Deinum Jan 27 '20 at 08:38
  • Well that's kind of sad news for me because the hibernate version is 3.3.0 which supports **MySQL5Dialect** or **MySQLDialect**. Found from (https://javadoc.io/doc/org.hibernate/hibernate-core/3.3.0.CR1/index.html) . However, Thanks for the help (@M.Deinum). I Appreciate it. – Shobuj Jan 27 '20 at 08:51

1 Answers1

0

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.

Shobuj
  • 47
  • 1
  • 7