Category Archives: Hibernate

[Solved] org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database may be already in use: null


Here JdbcSQLNonTransientConnectionException exception occurred because trying to connect H2 database through application while it’s already connected through eclipse data source explorer. That’s why when running application will through exception as “Database may be already in use :null“.

JdbcSQLnonTransientConnectionException Stacktrace


org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:617) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.get(DbException.java:194) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.mvstore.db.MVTableEngine$Store.convertIllegalStateException(MVTableEngine.java:193) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.mvstore.db.MVTableEngine$Store.open(MVTableEngine.java:173) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.mvstore.db.MVTableEngine.init(MVTableEngine.java:95) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Database.getPageStore(Database.java:2739) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Database.open(Database.java:769) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Database.openDatabase(Database.java:319) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Database.(Database.java:313) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Engine.openSession(Engine.java:69) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Engine.openSession(Engine.java:201) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Engine.createSessionAndValidate(Engine.java:178) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Engine.createSession(Engine.java:161) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Engine.createSession(Engine.java:31) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:336) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:169) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:148) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.Driver.connect(Driver.java:69) ~[h2-1.4.199.jar:1.4.199]

Solutions

Follow below steps to resolve this issue. You just need to follow disconnect steps. Connect steps are just to reference to reach Data source explorer.

Steps to connect with H2 database with Eclipse

  • Go to eclipse
  • Go to tab Window -> View -> Type “Data” – Click on “Data Explorer”.
  • Select “Generic JDBC”
  • Fill properties as below.
  • Then click on Finish.

H2 database connection

Steps to disconnect database through eclipse

  • Go to “Data Explore”.
  • Expend Database connection.
  • Right click on H2DB database
  • Select option Disconnect.

Now run  application your issue get resolved.

You would like to see

Follow below link to see more JDBC, Hibernate and JPA issues solutions.

 

Advertisements

[solved] org.h2.jdbc.JdbcSQLSyntaxErrorException: Column count does not match


JdbcSQLSyntaxErrorException occurred when the executing query has violated SQL syntax rules.

JdbcSQLSyntaxErrorException Example

In this example throwing JdbcSQLSyntaxException with message “Column count does not match” because table having two columns while inserting row with only one value without column name. Here DBMS will confuse like passing value is for which column and throw exception as below “Column count does not match”.

Entity Class

@Entity
@Table(name = "author")
public class Author {

	@Id
	@GeneratedValue
	private Long id;

	@NotNull
    @Size(max = 100)
    @Column(unique = true)
	private String name;

	//getter and setter
	}

Query to insert

#wrong way
insert into author  values('Saurabh Gupta');
insert into author  values ('Gaurav Gupta');

Exception Stacktrace

 
    Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Column count does not match; SQL statement:
     insert into author values('Saurabh Gupta') [21002-199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:451) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.get(DbException.java:205) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.get(DbException.java:181) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.get(DbException.java:170) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.dml.Insert.prepare(Insert.java:314) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.Parser.prepareCommand(Parser.java:689) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Session.prepareLocal(Session.java:627) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.engine.Session.prepareCommand(Session.java:565) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1292) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:217) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:205) ~[h2-1.4.199.jar:1.4.199]

Solutions

Thumb rule for database insert query is always mention the column name as below while inserting records so that if new column add on table or position change of columns in table then no code and query change required.

For above example the solution would be as below.

insert into author values(10001,'Saurabh Gupta');
insert into author values(10002,'Gaurav Gupta');

Recommend Solution

Here inserting records with column name.

insert into author (id, name) values(10001,'Saurabh Gupta');
insert into author (id, name) values(10002,'Gaurav Gupta');

You would like to see

Follow below link to see more JDBC, Hibernate and JPA issues solutions.

[Solved] java.sql.BatchUpdateException: Data truncation


BatchUpdateException is sub class of SQLException. BatchUpdateException occurred when any queries fail during batch update. BatchUpdateException also return the values of counts for each queries update before queries fail.

A SQL queries can fail because of  data constraints violations or syntax issues etc.

Below is some common situation where ConstraintViolationException occurs:

  • Insert a record with primary key as null.
  • Insert/ Update primary key value is not unique.
  • Insert data value size is more than predefine column size.
  • The inserted record data type is not compatible with predefined column type.

To see a complete list of Database integrity constraints follow this link :

Database Integrity Constraints List

BatchUpdateException Example

Here this exception is occurring because inserting  value of title  with size more than predefined as 100 characters.

@Entity
public class Publication {
	@Id
	@GeneratedValue
	protected Long id;

	@NotNull
	@Size(max = 100)
	@Column(unique = true)
	private String title;

	private int year;
	//getter and setter methods
	}
	

Exception Stacktrace

 
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO PUBLICATIONS(id, title, year) VALUES (?,?,?)]; Data truncation; nested exception is java.sql.BatchUpdateException: Data truncation
        at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:615)
        at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:884)
        at com.example.UserDAOImpl.batchInsertUsers(UsersDAOImpl.java:175)
        at com.example.UserServiceImpl.processData(UserServiceImpl.java:184)
        at com.example.UserMain.main(UserMain.java:23)
Caused by: java.sql.BatchUpdateException: Data truncation
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:947)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
        at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:899)
        at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:1)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)

Solutions

As title column configured is unique with size of 100 characters. Because here inserting value for title as more than 100 characters that’s what causing issues  and throwing DataIntegrityConstraintViolationException and BatchUpdateException but main cause of this exception is data truncation.

To resolve this issue pass title column value as less than 100 characters or increase size of column.

You would like to see

Follow below link to see more JDBC, Hibernate and JPA issues solutions.

[Solved] org.springframework.dao. DataIntegrityViolationException: PreparedStatementCallback -Data truncation


Hibernate throws ConstraintViolationException, when tries to insert a row or update particular column or delete records that violate underlying database integrity constraints.
Below is some common situation where ConstraintViolationException occurs:

  • Insert a record with primary key as null.
  • Insert/ Update primary key value is not unique.
  • Insert data value size is more than predefine column size.
  • The inserted record data type is not compatible with predefined column type.

To see a complete list of Database integrity constraints follow this link :

Database Integrity Constraints List

ConstraintViolationException Example

Here this exception is occurring because inserting  value of title  with size more than predefined as 100 characters.

@Entity
public class Publication {
	@Id
	@GeneratedValue
	protected Long id;

	@NotNull
	@Size(max = 100)
	@Column(unique = true)
	private String title;

	private int year;
	//getter and setter methods
	}
	

Exception Stacktrace

 
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO PUBLICATIONS(id, title, year) VALUES (?,?,?)]; Data truncation; nested exception is java.sql.BatchUpdateException: Data truncation
        at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:615)
        at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:884)
        at com.example.UserDAOImpl.batchInsertUsers(UsersDAOImpl.java:175)
        at com.example.UserServiceImpl.processData(UserServiceImpl.java:184)
        at com.example.UserMain.main(UserMain.java:23)
Caused by: java.sql.BatchUpdateException: Data truncation
        at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:947)
        at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
        at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:899)
        at org.springframework.jdbc.core.JdbcTemplate$4.doInPreparedStatement(JdbcTemplate.java:1)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)

Solutions

As title column configured is unique with size of 100 characters. Because here inserting vale for title as more than 100 characters that’s what causing issues  and throwing DataIntegrityConstaintViolationException.

To resolve this issue pass title column value as less than 100 characters or increase size of column.

You would like to see

Follow below link to see more JDBC, Hibernate and JPA issues solutions.

[Solved] org.h2.jdbc. JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation


Hibernate throws ConstraintViolationException, when tries to insert a row or update particular column or delete records that violate underlying database integrity constraints.
Below is some common situation where ConstraintViolationException occurs:

  • Insert a record with primary key as null.
  • Insert/ Update primary key value is not unique.
  • Insert data value size is more than predefine column size.
  • The inserted record data type is not compatible with predefined column type.

To see a complete list of Database integrity constraints follow this link :

Database Integrity Constraints List

ConstraintViolationException Example

Here this exception is occurring because inserting same value of title again that causing the issue . As configured title is unique.

@Entity
public class Publication {
	@Id
	@GeneratedValue
	protected Long id;

	@NotNull
	@Size(max = 100)
	@Column(unique = true)
	private String title;

	private int year;
	//getter and setter methods
	}

Exception Stacktrace


org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: 
"PUBLIC.UK_C5HPK0II0AH4H4EAAGM8HQUO0_INDEX_C ON PUBLIC.PUBLICATIONS(TITLE) VALUES 2"; SQL statement:
insert into publications (id, title, type, year) values (null, ?, ?, ?) [23505-199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:457) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.get(DbException.java:205) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.message.DbException.get(DbException.java:181) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:103) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.mvstore.db.MVSecondaryIndex.checkUnique(MVSecondaryIndex.java:220) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:196) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.mvstore.db.MVTable.addRow(MVTable.java:546) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.dml.Insert.insertRows(Insert.java:180) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.dml.Insert.update(Insert.java:132) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.CommandContainer.update(CommandContainer.java:133) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.command.Command.executeUpdate(Command.java:267) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:200) ~[h2-1.4.199.jar:1.4.199]
    at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:154) ~[h2-1.4.199.jar:1.4.199]
    at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-3.2.0.jar:na]
    at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-3.2.0.jar:na]
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]

Solutions

As title column configured is unique will not allow duplicate values. Because here unique integrity constraint is violating that’s why throwing JDBCIntegrityConstaintViolationException.

To resolve this issue pass primary key column value as unique and not NULL.

You would like to see

Follow below link to see more JDBC, Hibernate and JPA issues solutions.

[Solved] org.springframework.dao. DataIntegrityViolationException: could not execute statement


Hibernate throws ConstraintViolationException, when tries to insert a row or update particular column or delete records that violate underlying database integrity constraints.
Below is some common situation where ConstraintViolationException occurs:

  • Insert a record with primary key as null.
  • Insert/ Update primary key value is not unique.
  • Insert data value size is more than predefine column size.
  • The inserted record data type is not compatible with predefined column type.

To see a complete list of Database Integrity Constraints follow this link :

Database Integrity Constraints List

ConstraintViolationException Example

Here below exception is occurring because inserting value of primary key as null.

@Entity
public class Publication {
	@Id
	@GeneratedValue
	protected Long id;

	@NotNull
	@Size(max = 100)
	@Column(unique = true)
	private String title;

	private int year;
	//getter and setter methods
	}

Exception stacktrace


org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; 
constraint [\"PUBLIC.UK_C5HPK0II0AH4H4EAAGM8HQUO0_INDEX_C ON PUBLIC.PUBLICATIONS(TITLE) VALUES 2\"; 
SQL statement:\ninsert into publications (id, title, type, year) values (null, ?, ?, ?) [23505-199]]; 
nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:296)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:253)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:527)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:153)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:138)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
    at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
    at com.sun.proxy.$Proxy121.save(Unknown Source)
    at com.pub.PublicationServices.controller.AuthorsCrudController.createAuthor(AuthorsCrudController.java:69)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
    at org.springframework.web.servlet.mvc.

Solutions

As primary key rule states that columns set as primary key not allowed Null value and only contained unique values so that row can uniquely identified base don primary key.

To resolve this issue pass primary key column (id) value as unique and not NULL.

You would like to see

Follow below link to see more Hibernate and JPA issues solutions.

[Solved] org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set


Here this issue occurred while connecting to database through Hibernate and not declared dialect while mentioning all connection properties. In hibernate dialect is required properties so that hibernate known what type of queries need to generate because every database have different queries patterns.

Exception Stacktrace


Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
    at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:137) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:94) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263) ~[hibernate-core-5.3.10.Final.jar:5.3.10.Final]

Solutions

Below is example to connect to H2 database by hibernate. You can update properties values according to your database. Added hibernate.dialect to connect H2 database.

Hibernate Supported Dialect List

In hibernate.cfg.xml

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

In application.properties with Spring boot + JPA

spring.jpa.database-platform=org.hibernate.dialect

References

https://stackoverflow.com/questions/24655684/spring-boot-default-h2-jdbc-connection-and-h2-console

Hibernate : SQL Dialects List


Hibernate supports many databases, by using dialect (hibernate.dialect) property in hibernate generates the appropriate SQL for the selected database. This idea makes us to develop database vendor independent application so that if you switch to another application just change dialect only.

Define dialect : Below is example of dialect for H2 database you can use according to your database.

In hibernate.cfg.xml

<property>
         org.hibernate.dialect.H2Dialect
</property>

In application.properties with Spring boot + JPA

spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

List of Hibernate SQL Dialects

Following is the lists of Dialects provided by hibernate to connect different databases:

Note : Click on database name link to know method of hibernate dialect methods.

RDBMS DIALECT
Cache 71 org.hibernate.dialect.Cache71Dialect
DB2 org.hibernate.dialect.DB2Dialect
DB2 AS/400 org.hibernate.dialect.DB2400Dialect
DB2 OS390 org.hibernate.dialect.DB2390Dialect
Derby org.hibernate.dialect.DerbyDialect
Firebird org.hibernate.dialect.FirebirdDialect
FrontBase org.hibernate.dialect.FrontbaseDialect
H2 Database org.hibernate.dialect.H2Dialect
HypersonicSQL org.hibernate.dialect.HSQLDialect
Informix org.hibernate.dialect.InformixDialect
Interbase org.hibernate.dialect.InterbaseDialect
Ingres org.hibernate.dialect.IngresDialect
Ingres 9 org.hibernate.dialect.Ingres9Dialect
Ingres 10 org.hibernate.dialect.Ingres10Dialect
JData Store org.hibernate.dialect.JDataStoreDialect
Mckoi SQL org.hibernate.dialect.MckoiDialect
Microsoft SQL Server 2000 org.hibernate.dialect.SQLServerDialect
Microsoft SQL Server 2005 org.hibernate.dialect.SQLServer2005Dialect
Microsoft SQL Server 2008 org.hibernate.dialect.SQLServer2008Dialect
MySQL 5 org.hibernate.dialect.MySQLDialect
MySQL with InnoDB org.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect
Mimer SQL org.hibernate.dialect.MimerSQLDialect
Oracle (any version) org.hibernate.dialect.OracleDialect
Oracle 8 org.hibernate.dialect.OracleDialect
Oracle 9i org.hibernate.dialect.Oracle9Dialect
Oracle 10g org.hibernate.dialect.Oracle10Dialect
Oracle 11g org.hibernate.dialect.Oracle10Dialect
Pointbase org.hibernate.dialect.PointbaseDialect
PostgreSQL org.hibernate.dialect.PostgreSQLDialect
PostgreSQL 8.1 org.hibernate.dialect.PostgreSQL81Dialect
PostgreSQL 8.2 org.hibernate.dialect.PostgreSQL82Dialect
PostgrePlus org.hibernate.dialect.PostgresPlusDialect
Progress org.hibernate.dialect.ProgressDialect
RDMSOD 2200 org.hibernate.dialect.RDMSOS2200Dialect
SAP DB org.hibernate.dialect.SAPDBDialect
Sybase org.hibernate.dialect.SybaseDialect
Sybase Anywhere org.hibernate.dialect.SybaseAnywhereDialect
Sybase ASE 15.5 org.hibernate.dialect.SybaseASE15Dialect
Sybase ASE 15.7 org.hibernate.dialect.SybaseASE157Dialect
Tera Data org.hibernate.dialect.TeradataDialect
Times Ten org.hibernate.dialect.TimesTenDialect

Note: This is not mandatory to be given in hibernate.cfg.xml file.

References