16.4.4. 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 Enterprise Application Platform. 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 production databases, you can configure the database dialect in the <JBOSS_HOME>/server/<PROFILE>/deployers/ejb3.deployer/META-INF/jpa-deployers-jboss-beans.xml file. To configure this file you need to uncomment the set of tags related to the map entry hibernate.dialect and change the values to the following based on the database you setup.
  • Oracle 10g: org.hibernate.dialect.Oracle10gDialect
  • Oracle 11g: org.hibernate.dialect.Oracle10gDialect
  • Microsoft SQL Server 2008: org.hibernate.dialect.SQLServerDialect
  • PostgresSQL 8.2.3: org.hibernate.dialect.PostgreSQLDialect
  • PostgresSQL 8.3.7: org.hibernate.dialect.PostgreSQLDialect
  • MySQL 5.0: org.hibernate.dialect.MySQL5InnoDBDialect
  • MySQL 5.1: org.hibernate.dialect.MySQL5InnoDBDialect
  • DB2 9.1: org.hibernate.dialect.DB2Dialect
  • Sybase ASE 15: org.hibernate.dialect.SybaseASE15Dialect