Starting with Hibernate ORM 5.2.8, MariaDB gets its own Hibernate dialects.
Dialect variants
For the moment, you can use one of the following two options:
MariaDBDialect
-
which is the base class for all MariaDB dialects and it works with any MariaDB version
MariaDB53Dialect
-
which is intended to be used with MariaDB 5.3 or newer versions
In time, we will add new Dialects based on newer capabilities introduced by MariaDB.
Connection properties
While to connect to a MySQL application, the connection properties look as follows:
-
'db.dialect' : 'org.hibernate.dialect.MySQL57InnoDBDialect',
-
'jdbc.driver': 'com.mysql.jdbc.Driver',
-
'jdbc.user' : 'hibernate_orm_test',
-
'jdbc.pass' : 'hibernate_orm_test',
-
'jdbc.url' : 'jdbc:mysql://127.0.0.1/hibernate_orm_test'
For MariaDB, the connection properties look like this:
-
'db.dialect' : 'org.hibernate.dialect.MariaDB53Dialect',
-
'jdbc.driver': 'org.mariadb.jdbc.Driver',
-
'jdbc.user' : 'hibernate_orm_test',
-
'jdbc.pass' : 'hibernate_orm_test',
-
'jdbc.url' : 'jdbc:mariadb://127.0.0.1/hibernate_orm_test'
While the URL includes the mariadb
database identifier, the MariaDB53Dialect
supports Time
and Timestamp
with microsecond precision, just like MySQL57InnoDBDialect
.