When we configure a data source using Hibernate, we should add the hibernate.dialect
property (or eclipselink.target-database
if you are using Ecli
Hibernate uses "dialect" configuration to know which database you are using so that it can convert hibernate query to database specific query.
Dialect property is used by hibernate in following ways
Dialect means "the variant of a language". Hibernate, as we know, is database agnostic. It can work with different databases. However, databases have proprietary extensions/native SQL variations, and set/sub-set of SQL standard implementations. Therefore at some point hibernate has to use database specific SQL. Hibernate uses "dialect" configuration to know which database you are using so that it can switch to the database specific SQL generator code wherever/whenever necessary.
Short answer
hibernate.dialect
property makes Hibernate to generate the appropriate SQL statements for the chosen database.
The dialect in the Hibernate context, will take care of database data type, like in orace it is integer however in SQL it is int, so this will by known in hibernate by this property, how to map the fields internally.
Databases implement subtle differences in the SQL
they use. Things such as data types for example vary across databases (e.g. in Oracle You might put an integer value in a number field and in SQL Server use an int field). Or database specific functionality - selecting the top n rows is different depending on the database. The dialect abstracts this so you don't have to worry about it.