站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 3.2.3 正式版 API 英文文档

DialectFactory (Hibernate API Documentation) - Hibernate 3.2.3 正式版 API 英文文档


org.hibernate.dialect
Class DialectFactory

java.lang.Object
  extended byorg.hibernate.dialect.DialectFactory

public class DialectFactory
extends Object

A factory for generating Dialect instances.

Author:
Steve Ebersole

Nested Class Summary
static interface DialectFactory.DatabaseDialectMapper
          For a given database product name, instances of DatabaseDialectMapper know which Dialect to use for different versions.
static class DialectFactory.VersionInsensitiveMapper
          A simple DatabaseDialectMapper for dialects which are independent of the underlying database product version.
 
Constructor Summary
DialectFactory()
           
 
Method Summary
static Dialect buildDialect(Properties props, String databaseName, int databaseMajorVersion)
          Builds an appropriate Dialect instance.
static Dialect buildDialect(String dialectName)
          Returns a dialect instance given the name of the class to use.
static Dialect determineDialect(String databaseName, int databaseMajorVersion)
          Determine the appropriate Dialect to use given the database product name and major version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialectFactory

public DialectFactory()
Method Detail

buildDialect

public static Dialect buildDialect(Properties props,
                                   String databaseName,
                                   int databaseMajorVersion)
                            throws HibernateException
Builds an appropriate Dialect instance.

If a dialect is explicitly named in the incoming properties, it is used. Otherwise, the database name and version (obtained from connection metadata) are used to make the dertemination.

An exception is thrown if a dialect was not explicitly set and the database name is not known.

Parameters:
props - The configuration properties.
databaseName - The name of the database product (obtained from metadata).
databaseMajorVersion - The major version of the database product (obtained from metadata).
Returns:
The appropriate dialect.
Throws:
HibernateException - No dialect specified and database name not known.

determineDialect

public static Dialect determineDialect(String databaseName,
                                       int databaseMajorVersion)
Determine the appropriate Dialect to use given the database product name and major version.

Parameters:
databaseName - The name of the database product (obtained from metadata).
databaseMajorVersion - The major version of the database product (obtained from metadata).
Returns:
An appropriate dialect instance.

buildDialect

public static Dialect buildDialect(String dialectName)
Returns a dialect instance given the name of the class to use.

Parameters:
dialectName - The name of the dialect class.
Returns:
The dialect instance.