mysqlhibernate

How to mention MySQLDialect for Hibernate 5.4.17 and MySQL 8.0?


I'm using Hibernate 5.4.17 in the hibernate.cfg.xml file. I have the dialect property like this:

<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

Is this fine to use or Should I change it to:

 <property name="dialect">org.hibernate.dialect.MySQL8Dialect</property>

Solution

  • The version of your hibernate dialect should be as closer as possible to your database version. But should not be higher than database version. So for your case the org.hibernate.dialect.MySQL8Dialect will be the best choice.

    See also this section of the hibernate documentation for further details.