JBoss.org Community Documentation

13.7. Specify Database Dialect for Java Persistence API

The Java Persistence API (JPA) entity manager can save EJB3 entity beans to any backend database. Hibernate provides the JPA implementation in JBoss AS. Hibernate has a dialect auto-detection mechanism that works for most databases including the dialects for databases referenced in this appendix which are listed below. If a specific dialect is needed for alternative databases, you can configure the database dialect in the <JBoss_Home>/server/all/deploy/ejb3.deployer/META-INF/persistence.properties file. You need to un-comment the hibernate.dialect property and change its value to the following based on the database you setup. For a complete list of dialects, refer to the Hibernate Reference Guide, Chapter 3, Section 4.1 SQL Dialects.

  • Oracle 9i: org.hibernate.dialect.Oracle9iDialect

  • Oracle 10g: org.hibernate.dialect.Oracle10gDialect

  • Microsoft SQL Server 2005: org.hibernate.dialect.SQLServerDialect

  • PostgresSQL 8.1: org.hibernate.dialect.PostgreSQLDialect

  • MySQL 5.0: org.hibernate.dialect.MySQL5Dialect

  • DB2 8.0: org.hibernate.dialect.DB2Dialect

  • Sybase ASE 12.5: org.hibernate.dialect.SybaseDialect

DB2 7.2 with Universal JDBC Driver (Type 4)

Large Objects (LOBs) are supported only with DB2 Version 8 servers and above with the universal JDBC driver. Hence JMS services which stores messages as BLOBS and Timer services which uses BLOB fields for storing objects do not work with the JDBC Type 4 driver and DB2 7.2.

DB2 7.2 with JDBC Type 2 driver

All JBoss services work with the JDBC Type 2 driver and DB2 Version 7.2 servers.