Hibernate Dialects

Dialect is a Java class available in org.hibernate.dialect package, which helps to map Java Application with the database. To interact with the database, we need to define the required database dialect in the hibernate.cfg.xml file. Hibernate uses dialect configuration to identify which database a user is using.

The org.hibernate.dialect package contains a bunch of dialect classes which are supported by the Hibernate framework with the latest functionalities of the databases.

Hibernate is database-independent as it provides ‘Database Dialect’ so we need not write SQL queries. The main aim of dialect is to translate HQL queries into native database format because HQL is a database-independent language. For example, if we are using the Oracle database, we need Oracle dialect to convert the HQL query into Oracle format. 

Syntax of Dialect

Let’s see how we use dialect in the configuration file.

In the above example, we have used the Oracle 9i dialect for the database connection.

List of Hibernate Database Dialect

There are many Hibernate Database dialects available in org.hibernate.dialect package. They are listed below:

                                 RDBMS                           Dialects
DB2 org.hibernate.dialect.DB2Dialect
DB2 AS/400 org.hibernate.dialect.DB2400Dialect
PostgreSQL 8.1 org.hibernate.dialect.PostgreSQL81Dialect
PostgreSQL 8.2 and later org.hibernate.dialect.PostgreSQL82Dialect
MySQL5 org.hibernate.dialect.MySQL5Dialect
MySQL5 with InnoDB org.hibernate.dialect.MySQL5InnoDBDialect
MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version) org.hibernate.dialect.OracleDialect
Oracle 9i org.hibernate.dialect.Oracle9iDialect
Oracle 10g org.hibernate.dialect.Oracle10gDialect
Oracle 11g org.hibernate.dialect.Oracle10gDialect
Sybase ASE 15.5 org.hibernate.dialect.SybaseASE15Dialect
Sybase ASE 15.7 org.hibernate.dialect.SybaseASE157Dialect
Microsoft SQL Server 2000 org.hibernate.dialect.SQLServerDialect
Microsoft SQL Server 2005 org.hibernate.dialect.SQLServer2005Dialect
Microsoft SQL Server 2008 org.hibernate.dialect.SQLServer2008Dialect
SAP DB org.hibernate.dialect.SAPDBDialect
Informix org.hibernate.dialect.InformixDialect
HypersonicSQL org.hibernate.dialect.HSQLDialect
H2 Database org.hibernate.dialect.H2Dialect
Ingres org.hibernate.dialect.IngresDialect
Progress org.hibernate.dialect.ProgressDialect
Interbase org.hibernate.dialect.InterbaseDialect
Pointbase org.hibernate.dialect.PointbaseDialect
FrontBase org.hibernate.dialect.FrontbaseDialect
Firebird org.hibernate.dialect.FirebirdDialect
Mckoi SQL org.hibernate.dialect.MckoiDialect
Teradata org.hibernate.dialect.Teradata
MariaDB org.hibernate.dialect.MariaDB
TimesTen org.hibernate.dialect.TimesTen
Derby version 10.5 org.hibernate.dialect.DerbyTenFive

Pin It on Pinterest

Share This