Learn with best explanation

Coding tutorials and solutions

Usage of SQL Dialects in Hibernate

The dialect is used to specify the type of database used in hibernate so that hibernate can generate SQL statements for specified database. It is necessary to provide the configuration of SQL dialect for connecting any hibernate application with database. It is usually placed in configuration file like we had placed in hibernate.cfg.xml file in the last example

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

List of commonly used SQL Dialects in Hibernate

There are various Dialects classes defined for RDBMS in the org.hibernate.dialect package. Following is the list.

Dabase name Dialect
 MySQL  org.hibernate.dialect.OracleDialect
 MySQL5  org.hibernate.dialect.MySQL5Dialect
 Oracle (any version)  org.hibernate.dialect.OracleDialect
 Oracle9i  org.hibernate.dialect.Oracle9iDialect
 Oracle10g  org.hibernate.dialect.Oracle10gDialect
 MySQL with InnoDB  org.hibernate.dialect.MySQLInnoDBDialect
 Microsoft SQL Server  org.hibernate.dialect.SQLServerDialect
 PostgreSQL  org.hibernate.dialect.PostgreSQLDialect
 DB2 AS/400  org.hibernate.dialect.DB2400Dialect
 DB2 OS390  org.hibernate.dialect.DB2390Dialect
Sybase org.hibernate.dialect.SybaseASE15Dialect
Interbase  org.hibernate.dialect.InterbaseDialect
H2 Database org.hibernate.dialect.H2Dialect
 MySQL with MyISAM  org.hibernate.dialect.MySQLMyISAMDialect