I’m configuring Hibernate for our project. On the server, we use 10.4.27-MariaDB, and we use Hibernate 6.1.7.Final.
Now I’m having problems configuring correct dialect. When I tried to let Hibernate detect dialect, it has detected it as MySQL 5, which was incorrect.
So I have tried org.hibernate.dialect.MariaDB103Dialect, but now I see a warning that it is deprecated and I should use generic MariaDBDialect.
So I have used MariaDBDialect, but now I’m getting this warning:
[org.hibernate.dialect.Dialect] HHH000511: The 5.5.0 version for [org.hibernate.dialect.MariaDBDialect] is no longer supported, hence certain features may not work properly. The minimum supported version is 5.7.0. Check the community dialects project for available legacy versions.
So - which dialect should I use? This is very confusing as it seems that none dialect is correct.
You don’t need to configure a dialect. Hibernate will detect that automatically on startup. Either way, the MariaDBDialect is the correct one. On bootstrap, Hibernate will use a JDBC connection to determine the version number of the database and configure the dialect accordingly, unless you configured hibernate.temp.use_jdbc_metadata_defaults=false, which you really shouldn’t.
No, this behavior is not intended. Hibernate should detect that you are running MariaDB. Which JDBC drivers are you using? You must use the JDBC drivers for MariaDB, not the MySQL ones.
I’m sorry for mystification beikov, it is indeed working correctly. It was an error on my side - I used com.mariadb.jdbc instead of org.mariadb.jdbc - it failed - and defaulted to MySQL connector (which is default fallback driver in our project).
Now everything works correctly and Hibernate is indeed very capable of detecting correct dialect.