Hibernate first checks for the dialect property in configuration file, if the property is missing then it uses the DB connection details and tries to load the default dialect that is suitable for your Database.
See this link for DialectFactory, it says:
Builds an appropriate Dialect instance. If a dialect is explicitly
named in the incoming properties, it should used. Otherwise, it is
determined by dialect resolvers based on the passed connection.
An exception is thrown if a dialect was not explicitly set and no
resolver could make the determination from the given connection.
And also here for Optional configuration properties, it says:
In most cases Hibernate will actually be able to choose the correct
org.hibernate.dialect.Dialect implementation based on the JDBC
metadata returned by the JDBC driver.
This link for SQL Dialects says, if you specify the dialect then hibernate tries to add some default values to some other properties based on given dialect:
Always set the hibernate.dialect property to the correct
org.hibernate.dialect.Dialect subclass for your database. If you
specify a dialect, Hibernate will use sensible defaults for some of
the other properties listed above. This means that you will not have
to specify them manually.
So finally it is recommended to specify the dialect, but even if you do not provide the details then hibernate tries to use the default dialect.